Personalized checkout and custom promotions with Shopify Scripts
Hi All,
Shopify has a limitation that it does not send the discount information in the carrier service API. As a carrier service API provider, I need the discount information to set my rates accordingly.
To overcome this limitation, I am exploring the line item script where I can access the cart and the included discount information. In the script, I am calculating the cart subtotal leaving the discount information and trying to send it in the line item properties field. However, the script is not allowing me to add the Money object to the properties object.
Below is my code.
cart = Input.cart
Input.cart.line_items.each do |line_item|
line_item.change_properties({"_cart_details"=>{"discounted_value"=> cart.subtotal_price }},message:"subtotal")
endOutput.cart = Input.cart
The script editor is throwing the below error.
Can anyone please help?
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024