Updating Checkout Line Item Price through Storefront API

Updating Checkout Line Item Price through Storefront API

kappaforce
Shopify Partner
2 0 1

Hello Shopify Community,

 

I would like to update the prices of checkout line items while a customer is in checkout - preferably through a Shopify API. The price of my products fluctuate based on the market price of gold. Correspondingly, I would like to display the updated price every minute until the point that the customer confirms the purchase.

 

I have a Shopify Plus store and have checkout.liquid and shopify scripts bulk discounts published and active. However, I need the feature of updating a product's price regardless of whether the price of my product has increased or decreased.

 

A 3rd-party API endpoint helps me update product prices on the Shopify admin, however, while testing the checkout process flow, I am unable to get the updated product price reflected in the checkout line item, even after the product price has been updated in the Shopify admin (completed through a Shopify Admin API request).

 

I know the Storefront GraphQL API has a CheckoutLineItemsUpdate mutation method, however, I need help understanding the process for authenticating and invoking this API through a script that is executed in node.js on an external server which I query from the checkout.liquid template.

 

Welcome to any and all suggestions! 🙂

Replies 0 (0)