Automatic discounts based of variation attributes.

Solved
Highlighted
Shopify Partner
5 1 0

Right now we have the following scenario:

00.png

As great as it might look it doesn't suffice the requirements that some customers (stores) will have, why?

 

Let's say that some store need to apply automatic discounts based on an attribute of its items, the current hierarchy for automatic discounts is All > Collection > Product, the current would not be good for them, because it would manage dynamic pricing only to a product level.

 

From this point I'd like to know more about the internal structure of a Shopify product in order to be able to create an automatic discount based on variation, so the structure would formally be All > Collection > Product > Variation.

 

For what I've seen in the files that could be used to bulk import items there are some interesting fields that help to build the variation as an abstract object of its own, these fields are OptionN Name and OptionN Value, where N is a number from 1 to, I don't know 5, 6 or whatever is the limit for "Options" (I think I have read something about a limit of 10, but I'm not sure).

 

So here is the thing, I'm not interested in developing an app, because that scenario would rely on API calls and it's not able to change the amount that will be charged to the end user LIVE as an automatic discount is.

 

Also, I'm not interested in developing an app because it would necessarily imply the need for permissions not only at a product level but also at a cart and even a checkout level, being the last two factors that I consider highly insecure.

 

I ask for guidance on how to enable automatic discounts based on string recognition on option name and data recognition on option values.

 

Thank you.

0 Likes
Highlighted
Shopify Partner
5 1 0

Hi.

 

Is there any news out ther about this?

It's planned to be on your analysis schedule soon?

Is there something that is only available for Shopify Plus that could help me in this?

It's something achievable with Scripts?

It's something that could be managed with Launchpad?

 

Thank you.

0 Likes
Highlighted
Shopify Partner
5 1 0

This is an accepted solution.

Hi, just wanted to share the solution I've been adviced to apply:

There are two Shopify Plus exclusive apps that help with this.

Launchpad

Script Editor

 

Create a new instance of your theme:

06.png

 

That's where you can work on product grid items and product pages within your theme in order to display a custom discount sale percentage, a custom price and a custom compare at price, without affecting directly your LIVE theme.

 

Then you can setup a line item script (Apps > Script Editor):

04.png

 

You can choose a preconfigured set of parameters or a blank template:

05.png

 

You need to reach each element of the line items within the current cart in the script you're going to make for purposes of this example (blank template recommended):

 

Input.cart.line_items.each

With special emphasis on

 

line_item.variant.title

 

That way you can enable through a Ruby script a direct comparison to a string.

 

When you are done with this you should be having 2 key factors covered:

  1. Collection pages prices and Product pages prices, with some liquid logic within your modified theme.
  2. Cart instances, Checkout, Emails and purchasing data in My Account (for your customers), with Script Editor.

 

Now it's time to automate the change, with Launchpad (Apps > Launchpad):

02.png

 

You can now define the details for a new event, enable theme switching and choosing the theme to display, also enable line item scripts and choosing the script that you've tested and designed.

03.png

 

That's pretty much it.

 

Many thanks to Mr. K. Fike, great lecturing.

 

0 Likes