make dccIsEnabled context aware

This commit is contained in:
David Remer 2020-07-23 14:53:37 +03:00
parent 7c5918eba3
commit 40b3e12057

View file

@ -484,13 +484,13 @@ class SmartButton implements SmartButtonInterface
return false; return false;
} }
$keys = [ $keys = [
'dcc_cart_enabled', 'dcc_cart_enabled' => 'is_cart',
'dcc_mini_cart_enabled', 'dcc_mini_cart_enabled' => '__return_true',
'dcc_checkout_enabled', 'dcc_checkout_enabled' => 'is_checkout',
'dcc_single_product_enabled', 'dcc_single_product_enabled' => 'is_product',
]; ];
foreach ($keys as $key) { foreach ($keys as $key => $callback) {
if ($this->settings->has($key) && $this->settings->get($key)) { if ($this->settings->has($key) && $this->settings->get($key) && $callback()) {
return true; return true;
} }
} }