Solved

Ruby Script

WizardofDeath
Tourist
12 0 1

How to I write a script in ruby when customer selects product A and Product D. the customer must get 30% off and freeshipping into the cart.

Accepted Solution (1)
playwright-mike
Shopify Partner
72 18 33

This is an accepted solution.

Hi @WizardofDeath

Apologies for the delay in getting back to you. I've attached the two scripts to this post. Make sure you copy them to the correct script type in the Script Editor app.

Let me know if the solution worked for you!
Matthew

Playwright | Create Shopify Scripts without writing code | https://playwrightapp.com
- Was my reply helpful? Please Like and Accept Solution.

View solution in original post

Replies 3 (3)

playwright-mike
Shopify Partner
72 18 33

Hi maltanvi,

The script can be written in many different ways. A few clarifications can help make sure you get the script/code you are looking for.

  1. How are you identifying Products A and D? (by tag, by Product ID, by Vendor?)
  2. Does a customer get 30% off just Products A and D or 30% off every item in the cart?
  3. "Free shipping" means discounting whichever shipping rate they chose (even expensive ones) to zero. Be sure to set up your shipping rates and zones correctly.

This will require two separate scripts, a Line Item script (for the 30% off) and a Shipping script (for free shipping). Those scripts will need to be added to the Script Editor app. Be sure you have that installed. I will await your clarifications before starting on the script.

Matthew

Playwright | Create Shopify Scripts without writing code | https://playwrightapp.com
- Was my reply helpful? Please Like and Accept Solution.

WizardofDeath
Tourist
12 0 1

HI Matt, Thanks for the reply.

We will identify the products using their product id's. Customer will get 30% off on the product bundle.

Lets say there is product A in cart. but there is not product D -> In such scenario there will be no discount

But if there is product A and Product D in cart then customer will get 30% off on cost of product A and D together.

Product A is $100 and product D is $50 then customer will get 30% off on $150.

If there Product A and D are found in customers cart then they will get FREESHIPPING as well.

The country zone for the same will be only USA and Canada.

in short -> product A + product D in customers cart = 30% off + freeshipping (only for USA and Canada)

 

playwright-mike
Shopify Partner
72 18 33

This is an accepted solution.

Hi @WizardofDeath

Apologies for the delay in getting back to you. I've attached the two scripts to this post. Make sure you copy them to the correct script type in the Script Editor app.

Let me know if the solution worked for you!
Matthew

Playwright | Create Shopify Scripts without writing code | https://playwrightapp.com
- Was my reply helpful? Please Like and Accept Solution.