Promotions need to perform some kind of action to apply the discount. This should be implemented by a new PromotionOffer plugin which implements \Drupal\Component\Plugin\ConfigurablePluginInterface, \Drupal\Core\Plugin\PluginFormInterface, and \Drupal\Core\Executable\ExecutablePluginBase.

The promotion offer plugin will define its scope via contexts and then have the inherited execute method to read its contexts and apply the configured promotion offer.

Bullet architecture in discussion with rszrama

  • action parameters define its scope (i.e. applies to an order vs. a line item)
  • action metadata defines its event (e.g. base price manipulation vs. a post­-tax adjustment); full event range is unknown, but at its most basic this will be:
    • Price availability
    • Base price selection (incl. price lists / currency conversion)
    • Pre­tax adjustments
    • Tax adjustments
    • Post­tax adjustments.
CommentFileSizeAuthor
#3 implement_offer_actions-2770747-3.patch18.55 KBmglaman

Comments

mglaman created an issue. See original summary.

mglaman’s picture

The plugin manager should implement categorization trait. Categorization should be done based on the "applies" entity so we could use AJAX to filter condition selection widget by "Order" or "Line item"

mglaman’s picture

StatusFileSize
new18.55 KB

Initial patch adding PromotionOffer plugins.

mglaman’s picture

Status: Active » Needs review
mglaman’s picture

Now that adjustments landed, tests are added for promotion offers. https://github.com/drupalcommerce/commerce/pull/445

bojanz’s picture

Status: Needs review » Fixed

It's done.

  • mglaman committed 9d24a9c on 8.x-2.x
    Issue #2770747 by mglaman: Implement offer actions (#445)
    

Status: Fixed » Closed (fixed)

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