How to Display Magento 2 Sale Label Based On Catalog Price Rules

How to Display Magento 2 Sale Label Based On Catalog Price Rules

The main task of each store (whether online or offline) is to attract and retain the possible customer’s attention. The store owners spend tons of hours and money to find the best way to reach this goal. However, it is not a secret that the best way to keep the customer’s attention is a discount. Once the user notices the lower price of the wanted product, he becomes your potential customer.

But how can you ensure the user notices your sale offer? In this article, we will tell you more about Sale Labels in Magento 2 that could be implemented with our Product Labels extension and will teach you how to use them based on catalog price rules.

How to Display Magento 2 Sale Label

1. Create and Configure Catalog Price Rule

First of all, you need to create a Magento 2 Catalog Price rule(s) to apply discounts on your products. If you have already created them, skip this step and proceed to creating a Sale label.

Magento 2 catalog price rules are the list of conditions that could be used to set discounts in your store based on the product’s attributes. To create a new catalog price rule, you should go to Marketing -> Promotions -> Catalog Price Rule and press the Add New Rule button. Here, you should fulfill the following:

Rule Information

Step-by-step guide:

  1. Enter the Rule name.
  2. Input a rule’s Description (optional).
  3. Set the Active configuration to Yes.
  4. Choose the Website where you would like to apply this rule.
  5. Choose which customer groups should apply the rule.
  6. Provide the From and To Dates to set the period when this rule should be active (optional).
  7. Set the rule’s Priority (optional).

Please note: If the same product is subject to multiple rules, Magento 2 will apply the rule with the highest priority for that product.

How to Display Magento 2 Sale Label: Create a New Catalog Price Rule

Conditions

In this section, you can set the parameters that define which product should be subject to this rule. You can also leave this section blank to apply the rule to all the products in your store.

Conditions could be created based on your product attributes. You can set multiple conditions and condition combinations to define a specific group of products. Here you can find an example of prepared conditions:

How to Display Magento 2 Sale Label: Set Conditions

In this case, a rule will be applied to the product if its SKU is one of the mentioned, its Material is Wool, Cotton, Fleece, or Jersey, and its Price is between 50 and 100.

Important Information:

You may face an issue when some product attributes are missing in the Conditions list. In this case, you should check if the missing attribute is added to the catalog price rule. To do so, go to Stores -> Attributes -> Product, and click on the needed attribute in the table.

In the attributes configurations, go to the Storefront Properties tab, find the Use for Promo Rule Conditions setting, and set it to Yes.

How to Display Magento 2 Sale Label: Check if the Missing Attribute is Added

Actions

The last section you should fulfill to make your new rule work is Actions. Here, you can find the following configurations:

  1. Apply”: Choose the type of discount you would like to implement.
  2. Discount Amount”: You can set the amount of the discount for this rule.
  3. Discard Subsequent Rules”: This configuration defines whether any other rules can be applied to the product if this rule already works for it.
How to Display Magento 2 Sale Label: Actions

After completing all the configuration steps described above, press Save and Apply button to make a new rule active.

2. Create a Magento 2 Sale Label

After you created and configured your Catalog Price Rule, you can use our Magento 2 Product Labels extension to display the Sale label.

After installing it, go to Plumrocket -> Product Labels -> Managel Labels and press the Add Label button.

In General configurations of the product label, you should fulfill the following:

Step-by-step guide:

  1. Set the Enable Label configuration to Yes.
  2. Type the sale label name in the Title configuration.
  3. Set the From and To Dates to set the period when this label should be active (optional).
  4. Set the label’s Priority (optional).
  5. Choose the Store View in which the label should be applied.
  6. Choose the Customer Groups for which the label should be visible.
Create a Magento 2 Sale Label: General Configuration

In the Display Settings tab, you should configure the visual of the sale label.

Step-by-step guide:

  1. Choose the Label Type.
  2. Choose the Position of the label.
  3. Choose the Label Image from the list or upload your custom one.
Create a Magento 2 Sale Label: General Configuration: Configure the Visual of the Sale Label —  Step 1-3
  1. Provide the Label Size.
  2. Type the Text of the label:
    • You can type static text.
    • You can use variables provided by our extension. In case of Sale label, we believe the most suitable ones are {{discount_amount}} and {{discount_percent}} that could display the sale information.
    • HTML tags are also allowed here. The list of the tags:
      b, i, cite, code, em, dfn, ins, mark, q, pre, s, span, small, strong, sub, sup, u, br.
  3. Select or type the Text Color.
  4. Enter the Text Size.
  5. Define Custom Styles (CSS) if needed.
  6. If you want to use the fulfilled settings on the Product Page, set the Use Product List Settings configuration to Yes.
Create a Magento 2 Sale Label: General Configuration: Configure the Visual of the Sale Label —  Step 4-9

3. Configure Magento 2 Sale Label Conditions

At this step, you have configured the product label, but it will be displayed for all the products. You must configure the label conditions to display the label only for some specific products.

If you want the Sale label to be displayed for the products that are on Sale at the moment, you should select the Sale attribute and set it to Yes.

Configure Magento 2 Sale Label Conditions: Display the Products that are on Sale

If you have a few active sales and would like to display labels for a specific one, you should duplicate the Catalog Price Rule’s conditions for the required sale. Taking into account the rule we described in this article, the Magento 2 Sale Label conditions would be as follows:

Configure Magento 2 Sale Label Conditions: Display Label for a Specific Product

As a result, the Sale label would be displayed on the products that are currently on sale:

Configure Magento 2 Sale Label Conditions: Sale Label Displayed