free shipping on first order for recharge subscriptions

SkyeC
Tourist
10 0 1

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:

  • loop through line items and look for a selling plan id
  • if found, update the shipping rate price to 0


Thanks.

Replies 3 (3)
SkyeC
Tourist
10 0 1

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

 

MyronL
Visitor
1 0 0

Were you able to find a solution here? I'm trying to figure out the same issue.

Nevin
Shopify Partner
8 0 1

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.

 

Best,

Nevin Jethmalani
Founder & CEO, Data Dish
Data Analytics and eCommerce Growth Consulting
hello@datadish.io