Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Load countries in wcSettings only when a block requires them #1726

Merged
merged 1 commit into from
Feb 13, 2020

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Feb 13, 2020

As discussed in #1574, since shippingCountries and availableCountries will be quite big once they include counties, we want to load them in wcSettings only when a block requires them. This PR implements that using the asset data registry.

How to test the changes in this Pull Request:

  1. Create a post with an All Products block. Preview it and run console.log( wcSettings ); in the console. Verify it doesn't have shippingCountries neither allowedCountries.
  2. Create a post with an Cart block. Preview it and run console.log( wcSettings ); in the console. Verify it does have shippingCountries but doesn't have allowedCountries.
  3. Create a post with an Checkout block. Preview it and run console.log( wcSettings ); in the console. Verify it does have both shippingCountries and allowedCountries.

@Aljullu Aljullu requested a review from a team as a code owner February 13, 2020 09:44
@Aljullu Aljullu self-assigned this Feb 13, 2020
@Aljullu Aljullu requested review from mikejolley and removed request for a team February 13, 2020 09:44
Copy link
Member

@mikejolley mikejolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Think "3" you meant checkout but I tested it anyway :)

@Aljullu
Copy link
Contributor Author

Aljullu commented Feb 13, 2020

Think "3" you meant checkout but I tested it anyway :)

Right, fixed!

@Aljullu Aljullu merged commit 5a1fcbf into master Feb 13, 2020
@Aljullu Aljullu deleted the update/country-settings-available-when-needed branch February 21, 2020 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants