liquid - Shopify changing product price for variation by app
I am a shopify partner, I am trying to get around the the variant limits of shopify by coding an app and also because my client has a complicated formula for calculating the price. I don't have a problem with the part that adds the information for my variants to the order, however when I want to modify the price based on the user selection, it doesn't seem an easy task to do.
I came across couple of apps which does the same thing by adding a new product or variation which is not optimal for my use case, is there any app that does the job without adding extra information to the database, if so, how?
Unfortunately, Shopify doesn't give us a lot of options to edit prices of items dynamically. Here are the two options that I know of that will allow you to adjust the price of a product directly - however, both have limitations.
Using Shopify Script Editor
If you're working with a Shopify Plus merchant, you can use the Shopify Script Editor (https://help.shopify.com/en/manual/checkout-settings/script-editor) to dynamically adjust the prices of products, provided that the direction you adjust is down. You cannot increase the price of a product using the script editor - so for your use case, the list price would have to be the most expensive possible price that the item sells for, which you would then discount appropriately using the app.
Using draft orders
Using an app, you can use Shopify's Draft Order API (https://shopify.dev/api/admin-rest/2021-10/resources/draftorder#%5Bpost%5D/admin/api/2021-10/draft_orders.json) to create an order with custom discounts and/or create completely custom items that are independent of the products set up in the product database.
The basic flow for this is that when the customer clicks 'checkout' you halt the normal navigation, send the cart contents to your app, create a draft order with the appropriate pricing, then supply the front-end code with the draft-order checkout/invoice URL so that you can send the customer there instead of the normal checkout. This has several limitations, however, including that prices of existing products can only be discounted, not increased, and the fact that Shopify will not allow a customer to use discount codes on a draft order invoice - once an order is set up this way, Shopify's assumption is that all prices are final.
Disclaimer: Sorry if someone sensible doesn't like a response with a link :) I'm not related to this app I'm just a user.
On a project with complex pricing, we use the app Wholesale Pricing Discount by Wholesale Helper (https://apps.shopify.com/wholesale-pricing-discount) we liked because is easy to import multiple pricing by-product and relate it by customer.
this app does not multiply the products, they use customer tags. maybe that can give you some guidance.
An important rule on Shopify is you can't increase the price by API on an order, you can just reduce i
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.