Skip to content

javascript

Auto Added by WPeMatico

How to get stock value in dropdown options on configurable probuct page?

I need to get the stock value of a simple product in the dropdown selector from the configurable product page. I found the _fillSelect method in module-configurable-product/view/frontend/web/js/configurable.js I override it with app/code/Vendor/ConfigurableProduct/view/frontend/web/js/configurable-mixin.js But I don’t understand how to get the… Read More »How to get stock value in dropdown options on configurable probuct page?

Inserting button in mini cart which is loaded by a javascript code

I need to add button in mini cart just below the “Proceed to checkout” button. And the button is loaded using this javascript code: let sourceUrl = “{some_url/index.js}”; let scriptEle = document.createElement(“script”); scriptEle.setAttribute(“src”, sourceUrl); scriptEle.setAttribute(“type”, “module”); document.head.append(scriptEle); const buttonHolder =… Read More »Inserting button in mini cart which is loaded by a javascript code

Magento 2 How to get td value using script and assign that value to php variable in same phml file?

I have php variable called itemId in same phtml file and i got td value using js. now i need to assign that var id value to $itemId variable. <?php $itemId = null; ?> <table class=”item-table”> <tr data-row=”product-item” id=”<?= $block->escapeHtmlAttr($item->getId())… Read More »Magento 2 How to get td value using script and assign that value to php variable in same phml file?

JavaScript not executed when it has Magento_Customer/js/customer-data dependencia in define

I have a JS file like this: define([ ‘jquery’, ‘underscore’, ‘matchMedia’, ‘text!ajaxcart/template/modal-slide.html’, ‘text!ajaxcart/template/modal-popup.html’, ‘Magento_Customer/js/customer-data’, ‘Magento_Catalog/product/view/validation’, ‘Magento_Ui/js/modal/modal’, ‘mage/translate’ ], function($, _, mediaCheck, _slideTpl, _popupTpl, customerData) { … } But for some reason, it is not entered into the code in function… Read More »JavaScript not executed when it has Magento_Customer/js/customer-data dependencia in define