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.
After discussing with rszrama, the conclusion was that we don't need a whole entity structure for keeping coupon-order information, it's painful to maintain and update.
A multiple coupon reference field or an entity reference field attached to the order entity would be enough, so we can have the coupons, no matter the type associated with the order at any time.
Also, for listing the coupons applied to the order, we can build a views handler to get the price component related with the coupon for displaying a coupon->discount relationship.
Comments
Comment #1
pcambraThis is a huge commit.
* Revamped all coupon log feature into a entity reference field in the order entity so we don't have log as a separate entity.
* Removed all coupon log traces.
* Removed coupon reference field in favor of entity reference.
* Provided a component name for price components as a property of the coupon entity.
* Fixed all rules accordingly.
* Moved coupon calculation logic from line_item_refresh to a rule that can be configured
* Provided rules for deleting coupons individually and in mass.
* Code cleaning.
* Probably more but can't remember.
Testing is really appreciated.