Magento 2 custom add to cart button on product page

I want to create a new Add to Cart button which takes the value based on the result of a calulator I’ve add the calculator to catalog_product_view.xml <block class=”Magento\Framework\View\Element\Template” template=”Magento_Theme::html/calc.phtml” name=”calc”/> Then I copied the code from addtocart.phtml to calc.phtml as the button and changed the QTY to my result value (var metres) <div class=”box-tocart”>…

Products orders list dose not show in (Items Ordered) Magento 2

placed orders store in database but not show in backend Error [2020-01-16 13:51:12] main.WARNING: Attempt to load value of nonexistent EAV attribute ‘191’ for entity type ‘Magento\Catalog\Api\Data\ProductInterface’. [] [] [2020-01-16 13:51:12] main.WARNING: Attempt to load value of nonexistent EAV attribute ‘168’ for entity type ‘Magento\Catalog\Api\Data\ProductInterface’. [] [] Screenshot:

How to convert layout block to cms block?

I have created a block programmatically which shows category name and image on home page. Following is my code: cms_index_index.xml <?xml version=”1.0″?> <page xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” layout=”2columns-left” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <body> <referenceContainer name=”content”> <block name=”homepage.category.thumbnail” class=”Magento\Framework\View\Element\Template” template=”Ktpl_CategoryCms::list.phtml”> <arguments> <argument name=”category_list” xsi:type=”object”>\Ktpl\CategoryCms\ViewModel\CategoryList</argument> </arguments> </block> </referenceContainer> </body> </page> This block taking data from viewmodal and showing in phtml file. If I…

Magento 2 : which event should I use when want to add free item in cart?

when purchase a Product X, want to add product Y automatically to code. It saves in cart but ‘save’ function is goes into loop because it also has event as ‘checkout_cart_save_after‘. events.xml <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Event/etc/events.xsd”> <event name=”checkout_cart_save_after”> <!– checkout_cart_save_after, checkout_cart_product_add_after –> <observer name=”add_gift_to_cart” instance=”Product\AddGift\Observer\AddFreeProductToCart” /> </event> </config> and observer : public function execute(\Magento\Framework\Event\Observer $observer) {…

Magento 2.3: How to hide only free shipping methods based on postal code

In this below code, i am hidiing all shipping methods based on postal code 2nd value is 0. In this case all shippings methods are removing. but i want to remove only free shipping. Can you explain how i can do this. require([‘mage/url’, ‘jquery’,’domReady!’ ,’jquery/ui’],function(url , $) { $(“[name=’postcode’]”).live(‘change’,function(){ postCode = $(“[name=’postcode’]”).val(); // console.log(postCode); postCode…

magento2-how to use javascript inside knockout in magento2

i want to use the <script type=”text/javascript”> require([ ‘jquery’ ], function(jQuery) { jQuery(‘input[name=”telephone”]’).keydown(function(event) { // Allow special chars + arrows if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || (event.keyCode == 65 && event.ctrlKey === true) || (event.keyCode >= 35 && event.keyCode <=…