Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Changing Price for Customer Types via API

Changing Price for Customer Types via API

1010101010
Shopify Partner
7 0 1

My client wants to change variant product prices for customers based on customer tag.

 

Ideally i was thinking of having a variant meta field where my client can easily update prices for customers with a specific tag, which i could then build a private shopify app to pull those prices and actually persist that price in cart and at checkout. 

 

But it seems i  cannot do this with the graphQL API. The pricing rules allow automatic discounts but its a max of 25 and a max of 5 per cart. Currently i can pull the prices to the storefront but it does not actually persist in the cart or at checkout, only the front end.

 

I could use a shopify script, but it reduces the flexibility for further developments we want to make.

 

Am i missing something with the GraphQL API?

Replies 4 (4)

PaulNewton
Shopify Partner
7450 657 1562

To clarify to change the price of a variant the price data has to literally be changed.

Altering the price for presentment in no way impacts what customers pay.

 

You probably want to see if this can be done with any of the currently released shopify-functions eithe order-discounts or product-discounts.

https://shopify.dev/docs/api/functions/#available-apis 

 

The baseline sane way to have multiple prices for merchandise is to have multiple variants with the needed prices; which in turn means for the online sales-channel customizations to weave it all together, hide the special variants , prevent invalid orders, and bunch of other side effects. Similar to a flat-product model aka product-family I have some writings on it in the forums.  

 

An alternative is using the draft orders api to swap in a checkout with custom data.

Example https://tasks.mechanic.dev/create-a-draft-order-from-the-cart 

 

If on the Plus plan making the checkout-scripts feature available  but don't want to use that feature then an alternative may be the B2B channel or wholesale channel /shrug.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


1010101010
Shopify Partner
7 0 1

Yeah of course the presentment is just what is showing int he front end but not persisting (obviously as anyone could change the price).

 

How are other apps doing it? Like wholesale apps like this https://orbitapps.com/wholesale-club-101-custom-prices/

Are they duplicating all the products in my store - hiding them from the "Products" section of the shopify CMS - and doing magic in the back end to link them up with the actual products to keep inventory in sync?

Thanks

Devs136
Visitor
1 0 0

I'm facing the same issue here,
Did you ever get it working with the custom pricing?
Or end up using the Shopify App's like the one you mentioned?

PaulNewton
Shopify Partner
7450 657 1562

As I outlined either do sleight of hand with pre-existing variants in the backend swapping them on the frontend conditionally, use discounts, or use apps that do similar, automation apps like mechanic, or shopify functions based apps, or create your own app to do any of the above and then some.

 

An alternative is using the draft orders api to swap in a checkout with custom data.

Example https://tasks.mechanic.dev/create-a-draft-order-from-the-cart 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org