Open vchiriacmoldoweb opened 9 months ago
@callanzimmermann
any chance you can include these functions changes in the block:
private $storeManager;
/**
* AddToCart constructor
*
* @param Template\Context $context
* @param ConfigInterface $config
* @param array $data
*/
public function __construct(
Template\Context $context,
private readonly ConfigInterface $config,
array $data = []
) {
parent::__construct($context, $config, $data);
$this->storeManager = $context->getStoreManager();
}
/**
* @return StoreManagerInterface
*/
public function getStoreManager()
{
return $this->storeManager;
}
/**
* If the cart should open after adding to cart
*
* @param null $scopeCode
* @return bool
*/
public function isAjaxAddToCartEnabled($scopeCode = null): bool
{
return $this->config->isAjaxAddToCartEnabled($scopeCode);
}
Describe the bug
Expected behavior
So this becomes a problem when you are trying to call the window.setAjaxCart(); based on ajax related results, you need to create a new block that extends AddToCart in order to include that function, all this just in order to have the check if the feature is enabled.