Personalized checkout and custom promotions with Shopify Scripts
Hi,
We've recently migrated Recharge to native Shopify checkout.
Previously, using Recharge's checkout for any orders with subscriptions in them allowed us to give free shipping using a 0 weight shipping rule as Recharge was using duplicate products for the order.
After the migration, all the products are unified now and this 0 weight rule can no longer be applied.
So I need to make any orders with a subscription in them to have free shipping. This is just on the first order as I have shipping turned off in Recharge for subsequent orders.
It seems like this can be handled with Scripts but I'm not exactly sure on the syntax.
Just on first guess:
Thanks.
Took a stab at it but not working.
hasSub = 0
Input.cart.line_items.each do |item|
if (item.selling_plan_id > 0)
hasSub = 1
end
end
if (hasSub && Input.cart.shipping_address.country_code == 'US')
Input.shipping_rates.each do |shipping_rate|
next unless shipping_rate.source == "USPS First Class"
shipping_rate.apply_discount(shipping_rate.price * 1, message: "Free Subscriber Shipping")
end
end
Output.shipping_rates = Input.shipping_rates
Were you able to find a solution here? I'm trying to figure out the same issue.
Happy to help! Feel free to shoot me an email at growth@bondchaingroup.com. It is pretty easy to take care of with a script.
User | RANK |
---|---|
4 | |
2 | |
2 | |
1 | |
1 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023