Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Add store details" task fails to mark as completed for selecting Nigeria based address #38181

Merged
merged 4 commits into from May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix "Add store details" task fails to mark as completed for selecting Nigeria based address
Expand Up @@ -69,6 +69,16 @@ public function get_action_url() {
* @return bool
*/
public function is_complete() {
$country = WC()->countries->get_base_country();
$country_locale = WC()->countries->get_country_locale();
$locale = $country_locale[ $country ] ?? array();

$hide_postcode = $locale['postcode']['hidden'] ?? false;
// If postcode is hidden, just check that the store address and city are set.
if ( $hide_postcode ) {
return get_option( 'woocommerce_store_address', '' ) !== '' && get_option( 'woocommerce_store_city', '' ) !== '';
}

// Mark as completed if the store address, city and postcode are set. We don't need to check the country because it's set by default.
return get_option( 'woocommerce_store_address', '' ) !== '' && get_option( 'woocommerce_store_city', '' ) !== '' &&
get_option( 'woocommerce_store_postcode', '' ) !== '';
Expand Down