We currently have an offer intended to only match specific products.
We took a shortcut here and made it have a Product autocomplete for selecting the products in question.
This can't scale because people will want to use all kinds of conditions to select products (select by category, field, etc).

We need to remove the product setting, and make offers have an entity_type defined in their annotation.
If the entity type is order item, the Promotion should pass only the order items that matched the product conditions to the offer (invoking it once per matching order item).

We'll want to share an update hook with #2885398: Remove the commerce_promotion_ prefix from condition and offer plugin IDs that will resave promotions so that the offer setting is removed, but a product condition is added in its place.

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Assigned: Unassigned » bojanz
bojanz’s picture

Title: Change the way product offers work » Refactor offers

Better title. We want to remove context, pass the entity directly.

bojanz’s picture

Status: Active » Needs review

Green on Travis: https://github.com/drupalcommerce/commerce/tree/offers

Needs an update function.

finne’s picture

Code looks good, and yes, needs update

finne’s picture

Status: Needs review » Needs work

  • bojanz committed 6323a83 on 8.x-2.x
    Issue #2886641: Refactor offers
    
bojanz’s picture

Status: Needs work » Fixed

Done. Thanks for reviewing, finne!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.