From 40b3e12057fd8b85e3138f2906391cc30696440c Mon Sep 17 00:00:00 2001 From: David Remer Date: Thu, 23 Jul 2020 14:53:37 +0300 Subject: [PATCH] make dccIsEnabled context aware --- modules.local/ppcp-button/src/Assets/SmartButton.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules.local/ppcp-button/src/Assets/SmartButton.php b/modules.local/ppcp-button/src/Assets/SmartButton.php index 324fe099d..39779f20f 100644 --- a/modules.local/ppcp-button/src/Assets/SmartButton.php +++ b/modules.local/ppcp-button/src/Assets/SmartButton.php @@ -484,13 +484,13 @@ class SmartButton implements SmartButtonInterface return false; } $keys = [ - 'dcc_cart_enabled', - 'dcc_mini_cart_enabled', - 'dcc_checkout_enabled', - 'dcc_single_product_enabled', + 'dcc_cart_enabled' => 'is_cart', + 'dcc_mini_cart_enabled' => '__return_true', + 'dcc_checkout_enabled' => 'is_checkout', + 'dcc_single_product_enabled' => 'is_product', ]; - foreach ($keys as $key) { - if ($this->settings->has($key) && $this->settings->get($key)) { + foreach ($keys as $key => $callback) { + if ($this->settings->has($key) && $this->settings->get($key) && $callback()) { return true; } }