:::: MENU ::::

Magento Tutorial | Magento Blog | Learn Magento 2

Cookies Consent Popup

Recently on one of our client’s stores. we ran into an issue with creating a Shopping Cart Price Rule promo. The goal was to create a rule where if there were 3 or more products with a certain SKU in the cart then apply a discount. However, when we went to create the rule – based on SKU – we realized that the conditions dropdown was no longer displaying the attributes as it had in the past. The dropdown looked something like this:

Please choose a condition to add…
Conditions Combination
Cart Item Attribute
– Price In cart
– Quantity in cart
– Row total in cart
Product Attribute
– Attribute Set
– Category

The fix that worked for us:
In the Magento Admin Panel go to Catalog > Attributes > Manage Attributes
Select any attribute that you’d like to be able to sort by in the conditions list. On the edit-a-attribute page, under “Frontend Properties” set “Use for Promo Rule Conditions” to “Yes”. Save the attribute.
Then go to System > Index Management and re‑index.

Now – when you go back to creating your Shopping Cart Price Rule, you will see your attribute in the conditions list.

Simple fix for an annoying issue.

I Found Solution for it and i hope its work for you. placeholder comes from : vendor/magento/module-catalog/Helper/Product.php i try to save my images directly in my theme on below path and it works.
app/design/frontend/Your/Theme/Magento_Catalog/web/images/product/placeholder
and put your images with below name in jpg format.
  • image.jpg
  • small_image.jpg
  • thumbnail.jpg
    Dont forget to do upvote if its work for you. cheers !!
Sometime we just need to use simple jQuery on checkout page but checkout element bind with knockout js so our jQuery not work smoothly so below is a way to call your jQuery after bind perticular element.

Use below code in your jquery and it will load after binding your element in page.

function waitForElement(query, callback){
    var poops = setInterval(function(){
        if(document.querySelector(query)){    
            clearInterval(poops);
            callback();
        }
    }, 100);
}

waitForElement(".class", function(){
    alert("element is loaded.. do stuff");
});
Put below code in anywhere in magento2 :- $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/custom.log');$logger = new \Zend\Log\Logger();$logger->addWriter($writer);$logger->info("Product Info ". $product->getSku() . "----- Id  ". $product->getId() );
Or you can try this : file_put_contents(BP . '/var/log/events.log', "$eventName\n", FILE_APPEND);