-
-
Notifications
You must be signed in to change notification settings - Fork 960
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
feat(product-duplicator): Copy prices in product duplicator #2900
feat(product-duplicator): Copy prices in product duplicator #2900
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for effervescent-donut-4977b2 canceled.
|
I'm seeing some issues in the files I committed. Some changes occured in files I didn't touch. I will review and update the PR Done |
As far as I can see, this would set the price of all variants to the price of the first variant in the array. I don't think that is good, as we are already looping through the variants at that point. |
I don't think that is the case. It's taking the price from the first price in the price array per variant. But I'll have a look. |
True, everything ok! Mistake on my side 😁 |
Yes, the current behaviour is a bug indeed, thanks for picking this up! I'm wondering is we can make this even smarter: in this change, we take the 1st price in the We could do something like const price = variant.productVariantPrices.find(p => idsAreEqual(p.channelId, ctx.channelId)?.price ?? /* fallback to 1st item */ Going even further, it could make sense to allow copying all prices in the current channel (for the case that there are multiple currencies set up for this channel). But this is out-of-scope for this bugfix, and could be considered as a potential feature for a future release. |
I'll review and update. Thanks for the feedback! |
I've added the requested changes and added a test for channel specific price copy |
@mschipperheyn Excellent work, especially on the e2e tests 👍 Thanks! |
Description
When you copy products using the product-duplicator all variants get a price of 0. This PR fixes that by also copying the prices.
I'm not sure if the original behavior was intentional or a bug. I considered it the latter. But if it was intentional, I can create an additional flag to ensure backward. compatibility.
Breaking changes
Checklist
📌 Always:
👍 Most of the time: