Magento offers a marketing feature called Cart Price Rules, which allows for the application of discounts to items in the shopping cart based on a set of conditions. The discount can be applied automatically as soon as the conditions are met, or when the customer enters a valid coupon code. Coupon codes can be generated for each cart price rule via the admin panel in Marketing -> Cart Price Rules
section. However, sometimes we need to automate this process. Let’s find out how to create a cart price rule and generate coupon codes programmatically in Magento 2.
In this blog post, I would like to share a pretty interesting and not obvious solution on how to join some additional details to cart item block on checkout cart page.
Let’s say we need to add the “Brand” custom product attribute and show its value within a specific block on the product view page and checkout cart page. It’s very simple in the scope of the product page, but how to deal with number cart items on checkout cart page. There are a couple of issues which you may face with. We will cover them further.
So you have added a new custom product attribute. It is not a problem to access and use it in Product View. And you probably know that you should enable it under the attribute settings page of Magento backend in order to make it available for the Product List (or category view) section. But what about checkout/cart area?