Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Option Value promo rule and Create Line Items promo action #12196

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mad-eel
Copy link
Contributor

@mad-eel mad-eel commented Oct 29, 2024

Fixes:

  • Add the Spree::LineItem#from_promotion to determine if the item was added through the promotion
  • Fix removing items added through the automatic promotion with the Spree::Promotion::Rules::OptionValue promo rule
  • Allow adding draft products to the cart when added through the promotion

@@ -147,6 +149,15 @@ def options=(options = {})
assign_attributes opts
end

def from_promotion
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful when we want to display proper info on eg. the storefront - instead of price, quantity picker, etc.

order: order,
variant: item.variant,
quantity: item.quantity - current_quantity,
options: { validate_only_quantity: true }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the possibility here to add a free item to the cart when it's in draft state

@mad-eel mad-eel force-pushed the fix/promos-rule-actions branch from ec5b65a to acf47fa Compare October 31, 2024 13:30
@mad-eel mad-eel force-pushed the fix/promos-rule-actions branch from acf47fa to 5e9c7f0 Compare November 7, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant