Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Followup of #2910160: Fix the "free shipping" offer type for percentage off shipping discounts.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff-7-8.txt | 5.89 KB | czigor |
#8 | commerce_discount-2913292-percentage_shipping-8.patch | 49.03 KB | czigor |
|
Comments
Comment #2
czigor CreditAttribution: czigor at Centarro commented"Shipping service upgrade" and "% off shipping" discounts are both included in the patch.
TODO: do manual tests and write automatic ones.
Comment #3
czigor CreditAttribution: czigor at Centarro commentedDid some manual tests combining all 3 shipping discount offer types and this patch seems to work. We still need automated tests.
Comment #4
czigor CreditAttribution: czigor at Centarro commentedAdded tests. Only 2 assertions fail when using shipping_upgrade discount combined with a 20% shipping discount. The shipping_upgrade discount's source service costs $5 (without the 20% discount), the target service originally costs $25 (without any discounts). When we are in the checkout shipping step, the 20% discount is applied on the source service, so $4 is displayed correctly. The target service obtains $4 too, also correctly.
However, when arriving at the review, there's no discount calculation for the source service, so the target service is set to $5 instead of $4.
Added a @todo to the appropriate part of the rules action, not sure yet how to solve this.
Setting it to 'Needs review' to trigger the testbot.
Comment #6
czigor CreditAttribution: czigor at Centarro commentedFixed the bug described in #4. Not the nicest fix ever, but don't know how else to get the discounted shipping rate inside the discount rules action.
Comment #7
czigor CreditAttribution: czigor at Centarro commentedRemoving an obsolete rules action.
The reason for only having one rules action (commerce_discount_shipping_service()) handling all three shipping offer types instead of having one action for each offer type is that the actions start the same (and I thought they would end the same too, but they don't).
Comment #8
czigor CreditAttribution: czigor at Centarro commentedMaking the code a bit more compact by outfactoring the price component addition and order saving into a helper function.
Comment #10
jsacksick CreditAttribution: jsacksick commentedCommitted, thanks!