No products in the cart.
This is a business case from a customer using our plugin ELEX Dynamic Pricing and Discounts Plugin for WooCommerce. He wants to give different discount rates for different categories, but for some of the products he wants to skip the category discount and give a fixed price for the product. The plugin in itself doesn’t have the option to exclude the products from any of the discount rules. So when he provides both the category rule and product rule fixed price discount it won’t work properly, or you might get a double discount. So the current issue could be the category discount might be applied to the fixed price discount for that product.
Let’s look at the scenario in more detail. If there is product A ($100), B ($50), and C ($200) in Category X and the shop owner wants to give 20% discount on the Category X but wants to give Product A a fixed price of $50 and the rest at 20% discount. Right now he’s getting the product A price showing at $40 since its giving 20% category discount on the fixed price discount of $50. But the other products ie, Product B shows $40 and product C $160 with the 20% category discount correctly.
Install and configure ELEX Dynamic Pricing and Discounts Plugin for WooCommerce
You need to purchase the plugin from the product link ELEX Dynamic Pricing and Discounts Plugin for WooCommerce. Once purchased you can download the plugin from your account page ( My Account > API downloads). Install the plugin on the WordPress plugin page. To know more about how to set up the plugin you can check our documentation here. Once the plugin is installed, you can go to WooCommerce menu and go to Dynamic Pricing to get to the plugin settings.
Set First Matched Rule And Prioritize the Product Rule
Under the dynamic Settings Tab, you can move the rules type that you’ll be using to the right and the rule types you don’t want to the left. And also, you can select a rule type and click to move it up or down to set the priority level. In this business case you’ll have to move the Product rule to the top and category rule in 2nd priority. Also, choose the calculation mode as ‘First matched’ rule as shown in the below image.
The reason for this set up is so that the plugin will take only one discount rule per product and if the product discount for the fixed price comes first, it will not calculate the discount for the same product with the category discount. The calculation mode has other options such as “Best discount”, which will check which rule offers the best discount and use that. “All matched rules” will calculate discount for all the rules applicable for that product. Right now we need only First match rule since we don’t want double discount happening and we need to calculate the fixed discount prior to the Category discount. Hence arranging the priority to the discount type and choosing the First match rule calculation mode allows us to achieve this business case.
Define The Product Rule
Now you can define the rules for the product as well as for categories. Go to ‘Discount Rules’ tab on the plugin settings, and click on Product rules, and click on add new rule. Now you’ll have to give a relative title to the rule. Also, choose the “rule applicable on” option as ‘Selected products’. Now you’ll have to add the products under the product field. You can enter the product ID or name and it will display the product associated with that ID or name. You can add one or more products depending on whether or not the same discount applies to those products. In this business case, as an example, we’ll add the product Woo Hoodie and choose “check for” option as Quantity, and select the minimum number as 1. You can leave the maximum quantity field blank if you don’t want to set any maximum quantity. And select the discount type as Fixed price and enter the value there – in this case, we’ll enter fixed price of $50.
And if you want this discount to apply to only few user roles or start from a certain date you can do so from the tab – allowed roles and date on the left. And you can set the date and enter the roles to which this rule should apply.
Define Category Rule
To add category rules, go to the plugin settings and under the Discount Rules tab you can click on Category rules. Add a new rule, and give it a suitable title, and add the category or multiple category names for which you want to offer discounts. Under the ‘check for’ option if you want the rule to apply when there are a number of different products, you can choose ‘No of items” or if you want to check for the total number of items from that category you can choose ‘Total units’. Set the minimum number and the maximum number. You can leave the max number blank if you don’t want to restrict the maximum number. and choose the discount type as percentage discount, and give the value as 20. If you want to give different discount to different category you can add new rule with the different discount type or value.
Now you can check the cart by adding Product A, B and C, and now the product rule will apply to the Product A since product rule is on higher priority than the category rule. And the category rule will apply to the rest of the products since the product rule does not apply to them and the category rule is the first applicable occurrence for product B and C.
This way you can have different discount type for your products and categories, and if you want to give priority to few rule types, you can just move it to the top in the priority in the plugin settings.
You can also check out other WooCommerce and WordPress plugins in ELEX.