Home › Forums › WoodMart support forum › Questions around dynamic discount
Questions around dynamic discount
- This topic has 2 replies, 2 voices, and was last updated 1 year, 3 months ago by Elise Noromit.
-
AuthorPosts
-
September 9, 2023 at 12:16 pm #494587
metuzaParticipantHello,
A few questions around Dynamic Discount functionality.
Is it somehow possible to set discount rule working by increment of only 1 item? Then i mean that user get discount when buying 2 items, and better discount on 3 items and so on. As far as i can see it is only possible to set ie. FROM =2 and TO=3. You can not set FROM=2 and TO= 2.
Also I miss the possibility to set rules working with all included items. Then i mean if i have included a variable product then rule should work on all variants, not only one of them. So if rule says 10% on purchase of 2 items then we should get 10% if buying ie. 1 size 39 and 1 size 40.
Also on standard simple products. If i include 3 different products then we should have an option to mix the discount so it work no matter which one of the 3 different products purchased as long as the total quantity is reached.
PS.. There is also some issues with bundled products. If some of the items included in the bundle has quantity enough to earn discount then it is discounted in addition to the full bundle. Using YITH bundle but i guess it will be the same with other bundle plugins.
Brgds
RuneSeptember 9, 2023 at 6:04 pm #494658
metuzaParticipantHi again,
I had to look into the code as the need of beeing able to set: from=2 and to=2 is important in my sites. So it was a 5 minutes fix and i hope this can be updated in a patch or next update.
First i did a small change to validation in discounts.js file. I made it possible to set the same value in FROM and TO fields.
Then in the file class-frontend.php i deactivated this code-snippet:
//$data[ $id ]['quantity'] = sprintf( //'%s%s%s', //$rules['_woodmart_discount_rules_from'], //array_key_last( $discount['discount_rules'] ) !== $id ? '-' : '', //! empty( $rules['_woodmart_discount_rules_to'] ) ? $rules['_woodmart_discount_rules_to'] : '+' //);
and added in this modified code-snippet:
$data[ $id ]['quantity'] = sprintf( '%s%s%s', $rules['_woodmart_discount_rules_from'] !== $rules['_woodmart_discount_rules_to'] ? $rules['_woodmart_discount_rules_from'] : '', array_key_last( $discount['discount_rules'] ) !== $id && $rules['_woodmart_discount_rules_from'] !== $rules['_woodmart_discount_rules_to'] ? '-' : '', ! empty( $rules['_woodmart_discount_rules_to'] ) ? $rules['_woodmart_discount_rules_to'] : '+' );
So now it is possible to create rules like this:
Buy 2 get 5%, buy 3 get 10%, buy 4 get 20% and so on.You can see how it looks in the discount table her:
https://www.villmarksbua.no/produkt/fritidsutstyr/turklaer-og-skotoy/sko-og-stovler/igloo-termo-vinterstovler-30c/I really hope this can be added to the next update or an patcher.
Brgds
RuneSeptember 12, 2023 at 2:01 am #495138
Elise NoromitMemberHello,
Thank you for your message, our developers will consider this option as a future request.
If you have any questions please feel free to contact us.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register