In Shopify scripts via ruby you could discount a line item by using the "change_line_price" function. This was agnostic of product variant ID and would only discount the checkout line item. This means if product A was in the cart twice, but was part of a deal if paired with product B, only 1 line item containing product A would be discounted. In shopify functions the product discount API targets a variant ID meaning product A would be discounted twice.
Example Cart using Shopify scripts ruby app - Correct functionality Product A - Discount by 10% if bought with product B Product B - Discount by 10% if bought with product A
Product A - Not discounted. Must add another product B line item
Example cart using Shopify functions product discount API - Incorrect functiaonlity
Product A - Discount by 10% if bought with product B Product B - Discount by 10% if bought with product A
Product A - Discounted by 10%. Product discount API is targeting variant ID therefor discounting both Product A's.
Does anyone have a solution whereby you can create the "change_line_price" functionality in Shopify functions please.