Customer Order Count

Highlighted
Shopify Partner
7 0 1

Hello,
I'm curious, is there any way to access the "customer.orders_count" property inside the Scripts App? Or possibly a special customer group I have created? I would like to make some special customer discounts and not rely on the use of tags, if possible.
Thank you for any help.

1 Like
Highlighted
Shopify Staff
Shopify Staff
7 0 5

Hi Kyle!

Currently, only the customer ID, email address, and tags are accessible through Scripts.

Are there any particular reasons why tags would not work for you?

1 Like
Highlighted
Shopify Partner
7 0 1

Hi Alan,

Thank you, understood. I did read that in the docs, but hoped I missed something.

I was looking for a way to auto-discount the first customer order without applying a code in checkout. I could add a hidden tag at account creation and then remove the tag with a webhook after the first order - but I like the Scripts app because I dont have to host my own private app. If I had access to the "order_count" variable, I wouldn't need to rely on tags at all.

Going back to the promo code is probably best. Thx.

0 Likes
Highlighted
Shopify Expert
690 0 70

I was hoping to apply a discount to customers who agree to marketing but have not ordered before (so, i.e. a reward for signing up that does not require a coupon code) but that would require another Customer variable be exposed: accepts_marketing as well as orders_count

It would be super cool to be able to say “hey if you have never purchased with us before but register & sign up to our email list you will automagically get 20% off!" 

I'm a million different people
1 Like
Highlighted
Shopify Partner
2294 116 352

I haven't gotten to sit down fully with scripts and it's late and i'm fuzzy,  but couldn't these get passed through LIP's? if plaintext is a concern md5 filter them

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
Highlighted
Shopify Partner
72 0 10

Ace! Thats answered my question - tags are available to scripts :)

How much is Shopify plus?

 

Thanks,

Rob

0 Likes
Highlighted
Shopify Staff
Shopify Staff
73 0 10

Hey Rob! 

With the PLUS plans, it would depend on your needs and requirement. You can learn more on the here on our Plus plans and reach out to the Plus team HERE for more details and information. :) 

Thanks again for posting. :) 

Dan | Shopify Guru
support@shopify.com

0 Likes
Highlighted
Shopify Staff
Shopify Staff
7 0 5

We've just recently added the orders_count and accepts_marketing? attributes to the Customer object. For further details, you can refer to the API documentation for the Customer object.

2 Likes
Highlighted
Shopify Expert
690 0 70

Alan Ly, dropping the script bombs today! This has the potential to be huge. Thanks.

I'm a million different people
0 Likes
Highlighted
New Member
5 0 0

Hi,

 

Are there any issues with order count?

I have the following code which for some reason doesn't work. I have this code included in customers/login.liquid right after {%- form 'customer_login' -%} .

 
{%- if customer.orders_count != 0 -%}
   <input type="hidden" id="customer_tags" name="customer[tags]" value="existing"/>
{% else %}
   <input type="hidden" id="customer_tags" name="customer[tags]" value=""/>
{% endif %}
 
0 Likes