I'm writing a custom integration with an external CRM and I need to get all promotions applied to the order.
I was looking into this, but I can't find a way to list all the promotions applied to a specific order.
In the order, I only see applied promotions with discount code.
Proposed solution:
Add a 'loadMultipleByOrder' function in the PromotionsUsage file (src/PromotionUsage.php).
This function should return all promotions applied to a specific order.
Maybe we need to return promotions and 'coupon-promotions' in a diffrent way, but we can think about how we do this I guess.
I'm not sure how commerce core handles this in other use cases.
Thanks for the feedback.
Issue fork commerce-3120504
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
AmeDSL commentedDid you found a solution for that?
Comment #3
santerref commentedI am using this method to load the applied promotions on the order:
Seems to do the trick for the moment.
Comment #4
anybodyAlternatively you can use
$order->collectAdjustments(['promotion']);Also see #3489854: $order->getAdjustments('promotion') returns no result even for order promotions
Is your questions answered then @pietermouton?
Comment #5
jsacksick commentedComment #6
pietermouton commentedI suppose so. Don't remember how I got around the issue 4 years ago, but I did eventually.