TLDR: Looking to dynamically (and non-destructively) change a product price based on an external API response
I have a client who makes custom parts for which they have a standalone site and API to calculate the cost to customer based on a variety of inputs. It’s used internally by the sales team for quote requests, but they would like a public interface (read: Shopify store) to show the price to the customer directly. They could then check out or have a draft order created and the sales team would reach out.
I’m looking to have the price persist for the draft order and in the cart through checkout, but not have that quoted price be set as the new product price (since it will change on every request). Is there a Storefront API endpoint to do this? Or would it be easier to create a product for it? They won’t have products or collections listed, so having numerous products created won’t really be an issue.
TYIA
I think this is feasible. You can leverage Shopify public apps like Sparklayer or dedicated B2B apps to support the quotes feature.
I think the simplest solution is to generate a discount code for that specific user. You can even autoapply a discount code in a graphql query: Solved: How can I get the automatic discount code applied in response of Cart Query using Storefro... - Shopify Community
1 Like
Hi @Kyle_Stych
Is the approach above insufficient, or can I mark this as solved?
I think my specific use case is too narrow to help many as the client is not actually hosting specific products on Shopify, so we can just create new ones from the API quote that can be pulled later for the customer.
Effectively, the product itself doesn’t exist until the quote is created. It’s fairly complex, but in short it’s aluminum that’s cut at lengths so using a whole unit costs less than cutting one short - hence the offsite API.
Sparklayer may be able to achieve what I need, but for $50/month it’ll be more cost effective after the first 2 quarters for me to build a custom app. For anyone else, it may be best to write metafield data on the product including the customer ID, draft order ID, and quoted price and then use CartLineCost - though I haven’t tested that and likely won’t what with my method of product creation.