Shopify extension equivalent of script change_line_price message parameter

Solved

Shopify extension equivalent of script change_line_price message parameter

Schmidtc63
Shopify Partner
100 14 27

We currently have this line item script:

 

Input.cart.line_items.each do |line_item|
   price = line_item.variant.price *.5
   puts price.inspect
   p_new_price = price * line_item.quantity
   price_message="SPECIAL PRICING: RETAIL KICKEE PANTS EMPLOYEE"
   line_item.change_line_price(p_new_price, message: price_message)
end

 

This results in something like this (different discount amount but you get the idea):

Schmidtc63_0-1712847171442.png

 

However, I can't find how to do the message part in a Shopify extension function. The most I've been able to come up with is altering the line item title:

Schmidtc63_1-1712847246173.png

 

Is this not possible with a function?

 

 

Accepted Solution (1)

JohnSmith6
Shopify Partner
7 2 4

This is an accepted solution.

It is possible with discount function. From what I see you are using line item cartTransform Had you ever try Product Discount Function.

https://shopify.dev/docs/apps/selling-strategies/discounts/experience/getting-started

View solution in original post

Replies 2 (2)

JohnSmith6
Shopify Partner
7 2 4

This is an accepted solution.

It is possible with discount function. From what I see you are using line item cartTransform Had you ever try Product Discount Function.

https://shopify.dev/docs/apps/selling-strategies/discounts/experience/getting-started

Schmidtc63
Shopify Partner
100 14 27

Great idea! Thank you.