Allow targeting specific cart lines with discount functions #199
Replies: 26 comments 13 replies
-
This is really a blocker for attributes based discount. |
Beta Was this translation helpful? Give feedback.
-
Just found out about this limitation today. Huge issue for Shopify plus clients where discounts might vary from line item to line item due to complex discount rules stores in cart line properties and where cart lines should be targeted by cart line item id. Here's a full example of the problem: Product Discount "ProductVariantTarget" accepts the "id" of the target variant. Does that mean we cannot apply discounts to specific cart line items?
Cart contains two line items of the same product variant because of the difference in cart line property "text" value.
However, I can't target the last line item, because they both have the same product variant id "123", so if I create a ProductVariantTarget with "id" = "123", then both line items will be discounted, instead of the last one. I can specify a quantity to make sure only one of them is targeted, but I can't choose which one. |
Beta Was this translation helpful? Give feedback.
-
Recently tried implementing logic to skip discounting any line item that is a subscription. However, if there are two line items with the same variant, one that isn't a subscription purchase and one that isn't, the discount applies to both as we can only target by variant id 😔 definitely a big blocker for extending our discount function's capabilities! |
Beta Was this translation helpful? Give feedback.
-
Is there any updates on this one? |
Beta Was this translation helpful? Give feedback.
-
I'm facing the SAME issue, good to know there are more people facing it too. I was thinking that was a problem with my code. Is there any updates on this? |
Beta Was this translation helpful? Give feedback.
-
I'm working on a free gift feature. These bugs are seriously affecting what we can do. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 this will be more useful in our case, if we can have some way to target the specific line item with some condition |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1, that would be useful and makes totally sense. |
Beta Was this translation helpful? Give feedback.
-
Please use the built-in upvoting instead of "+1" comments y'all. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I am having an issue with assigning discounts for same variant, but different attributes. My real case is:
Also will this feature support assignment of discounts for multiple line items? Important question. When can we expect the feature to be released? Is this feature will work along with assigning multiple discounts via single Discount Function? Reference: |
Beta Was this translation helpful? Give feedback.
-
I'm also facing a problem when it comes to applying discounts to the same product variant but they are different line items |
Beta Was this translation helpful? Give feedback.
-
We faced the same problem while investigating a possible migration from Shopify Script to a Function for our Plus client. We had to move back to scripts for now as their use case is not supported. Specifically, we are developing "pair" discounts, where every second product of a specific group or type gets a discount, for example, 50%. To achieve that we first need to order products by price from highest to lowest, and then for every second product - apply a discount. As the first and second line items can contain the same product - there is currently no way to apply such a discount using a function, but with scripts, we can do it very easily. |
Beta Was this translation helpful? Give feedback.
-
The limitation to only target productVariant is a hard blocker for our Shopify Plus client to migrate from Shopify Scripts. We have a lot of critical logic tied to campaigns and promos that are not possible with the current state of the Product Discount API. Like everyone else says we need to be able to target line items vs the very broad productVariant. |
Beta Was this translation helpful? Give feedback.
-
Facing the same issue, would really love to know if the team has any plans on releasing this in the upcoming releases. Thank you! |
Beta Was this translation helpful? Give feedback.
-
All, this enhancement is currently planned for Q1 of next year. |
Beta Was this translation helpful? Give feedback.
-
We also face the same issue which prevents us from switching to functions from scripts and also using the 1step checkout. It's a major and critical step to switch to the new checkout but impossible atm with scripts. Also when scripts is deprecating and support drops end of this year but the new functions is not yet fully usable then will there be an extension of the deadline or what is the official deadline for Shopify scripts? Can you tell when in Q1 because our clients are anxious and need clear timelines? Is it end of Q1 or beginning? |
Beta Was this translation helpful? Give feedback.
-
This seems to be moving in the right direction. However, I wish to clarify. We need a feature where any line item can be discounted by any amount. That there can be multiple line discounts, not just one. That discounting can be applied in any way we choose. i.e. we could have a cart: 177 - WPI (chocolate) x 2 Within one discount function we would need to be able to apply any kind of discount to any line item. Our internal rules may be:
Which would give: WPI (chocolate) x 2 (20% discount) i.e.
|
Beta Was this translation helpful? Give feedback.
-
Couldn't we use the cart transform API to set line item prices? https://shopify.dev/changelog/new-and-updated-operations-for-the-cart-transform-api Has anyone looked into this? |
Beta Was this translation helpful? Give feedback.
-
I just checked |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
This causes problems when discounts are applied to a cart where both a subscription and one-time purchase version of the same product variant are in the cart. Because discounts target only variant IDs, both will receive the discount. Most merchants I've spoken to were trying to create setups where only the one-time purchase version would get discounted. |
Beta Was this translation helpful? Give feedback.
-
Hey folks, we've got good news for you! As of the |
Beta Was this translation helpful? Give feedback.
-
✅ |
Beta Was this translation helpful? Give feedback.
-
Works like a charm! Thanks @dpwolf @nickwesselman 🔥 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The same variant ID can be in cart on multiple lines, with different attributes. But Shopify functions output requires to specify a variant ID instead of cart line item id:
To keep compatibility, another target type could be added (eg
cartLineItem
), besidesproductVariant
.Also requested by other partners on forums, ignored by Shopify: https://community.shopify.com/c/shopify-functions/feature-request-add-ability-to-discount-a-specific-cart-line/td-p/1801254
Beta Was this translation helpful? Give feedback.
All reactions