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.
Hey 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, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024