The physical process of rendering is conceptually the same as in Magento 1, but it differs from the code and architectural levels. Data meant for output to the browser accumulates in the controller in the internal variable Zend\Stdlib\Message::content, and is displayed by calling Magento\Framework\HTTP\PhpEnvironment::appendBody(). (more…)
According to statistics, 54% of people are more likely to buy a product if it is offered with a discount. The customer looks for a product with a lower price like it would be his/her second nature. As a basic rule, the store owner should fulfill the client’s desire to save money. It can be a great flaw to miss the opportunity to boost sales with digital coupons.
Fortunately, Magento 2 has various discount options in its arsenal:
- % off your purchase
- $ off your purchase
- Buy X products and get Y free
- Free Shipping
Let’s imagine we want to offer 35% discount on items from a specific category only, i.e. the customer adds to cart items from a definite category and from other ones, and will receive a discounted price on items from category set in the rule. We will need to follow these steps to create this shopping cart price rule:
1) Go to Marketing -> Promotions, choose Cart Price Rules.
2) Press Add New Rule. Then, in Rule Information, we type «35% discount» Rule Name and in Description – « 35% discount on Women category». We set Status to «Inactive» as we don’t need that the rule takes place immediately.
3) We choose Main Websites, there the discount will be available and the Customer Groups which can use the promotion.
Our discount will be available only to registered customers, so we do not select the “NOT LOGGED IN” option.
4) Next we choose “Specific Coupon” to assign a coupon to the price rule. Type a numeric Coupon Code which the customer will enter to get the discount. Now, we configure a limit on the number of times the coupon can be used and the limit of coupon application by the customer.
It is also possible to setup the period the coupon code will be valid for, but we will leave it blank for now. Our coupon priority is 1, what means that it is the highest one in relation to any other promotions active now.
We want to post it in RSS feeds, so it is set to Yes.
5) Next step is to define the rule conditions. As we want it to be applied to Women category, we need to select Product attribute combination and from drop-down select Women category and respective subcategories.
6) Let’s move to Action section. In Apply dropdown choose percent of Product Price. Write 35 in Discount amount field. We leave 0 in Maximum Qty Discount is Applied To field as we don’t want to limit the quantity of the same product the discount is applied to. We leave Discount Qty Step (Buy X) empty, as it is related to “Buy X get Y Free” discount option, which is not our case. Apply to Shipping Amount is set to No and it means that the discount is applied only to subtotal. Discard subsequent rules is set to No, as we don’t need all other rules to stop processing. We don’t want to offer Free shipping, so we put it to No.
The coupon will be applied only to items from Women category, when there are multiple items in the cart (from other categories). To make sure it works that way, we need to move to Apply the rule only to cart items matching the following conditions (leave blank for all items) section, select Category, click on three dots in ‘Category is … ‘ and choose Women category and Tops and Bottoms subcategories.
7) In Labels tab, we will specify the label for our discount. It will be visible in parentheses, next to discount on the total section. Our store has only one store view, but if you manage multiple store views, you can set the label for each one.
8) Everything is ready, we save promotion and test it.
Finally, we have a coupon code which will be applied to all products from Women category in the cart. And when, for example, 2 products are added to cart and one of them belongs to some other category, the discount will be applied to this product only, but not to the other one.