Open bartrylant opened 2 weeks ago
Hi @bartrylant
Thank you for your message and feedback.
We are currently working on extra features that will solve this in the upcoming Commerce 5.1
release.
If you are in need of this functionality right now you do have an option, although I understand the solution below is not absolutely ideal.
If you add your relationship field to both the product layout and the variant layout. You can then in the Product::EVENT_AFTER_SAVE
get all the variants for that product and update their relationship field with the same data and save them with Craft::$app->getElements()->saveElement($variant, false)
. This will save the same data and also trigger the update of catalog pricing.
This way you the relationship will also live on the variant and you can use the "Related to" rule as you mentioned about.
Again, I realise this isn't the smoothest way but is a solution for now why the functionality is being worked on.
I will keep this issue open and reference it when progress is being made with the 5.1
feature.
Thanks!
Hi @nfourtythree, Is there any ETA about when 5.1 would be released?
@WHITE-developer no exact time sorry but in the next few weeks.
What happened?
Description
In Commerce 4, sales (now called catalog pricing rules) could be linked to products related to a certain category. This was super easy for shop editors. They could relate certain products to a "super mega sale" category, or select certain brands (every product had a brand category relationship) to give a discount on just these brands. For Commerce 5, this doesn't seem to be the case anymore.
When I select
Store Management > Pricing Rules > Match Purchasable > Related to > Category
and select a category, the promotion is not applied to the products related to that category. Does Commerce just look at direct variant relationships instead of product relationships? More so: I entrified all categories, but if I doStore Management > Pricing Rules > Match Purchasable > Related to > Entry
I can only select one entry at a time (instead of selecting multiple). I now have to add every related entry as a new condition.Expected behavior
Show promotional price for all products related to a certain category or entry.
Actual behavior
Promotional price doesn't get shown when adding conditionals. It looks like conditions don't work.
What I need
Be able to select a category/product that relates to products. Show the promotional price on products related to the category/entry, like it was in Commerce 4. Be able to select multiple entries when relating to an entry.
This works
This does not work
Craft CMS version
Craft Pro 5.2.0
Craft Commerce version
5.0.10.1
PHP version
8.3.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
-