Fix "Add store details" task fails to mark as completed for selecting Nigeria based address (#38181)
* Fix "add store details" task fails to mark as completed for selecting Nigeria based address while OBW * Add changelog * Remove empty line * Fix lint
This commit is contained in:
parent
c3d06ad05f
commit
fa658a0e94
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix "Add store details" task fails to mark as completed for selecting Nigeria based address
|
|
@ -69,6 +69,16 @@ class StoreDetails extends Task {
|
|||
* @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', '' ) !== '';
|
||||
|
|
Loading…
Reference in New Issue