Hi everyone, i need assistance with a task. When submitting a product form, the product’s price, determined by multiplying the base price per meter of fabric (retrieved from a metafield) with a user-input value, needs to be updated. This price change should only affect the current session, not the entire inventory. I’ve already set up a serverless function to fetch the base price per meter using the product ID. Could you guide me on how to adjust the cart session price using GraphQL APIs, without creating a custom app? Or do you have other solutions?
Topic summary
Goal: Update a product’s price at form submission by multiplying a base price per meter (stored in a metafield) by a user-entered length, and apply this only to the current session/cart, not the global product price.
Current setup: A serverless function retrieves the base price per meter using the product ID. The request is to adjust cart/session pricing via GraphQL without building a custom app.
Suggestion: Price the product “per meter” and treat the user input as the quantity, which removes the external request dependency.
Constraint: The user requires decimal lengths (e.g., 0.25m, 0.50m, 0.66m), and any decimal input should be valid, making the quantity-based approach unsuitable if the system expects integer quantities.
Status: No resolved method provided yet. Open questions include how to implement session-specific price adjustments through GraphQL for arbitrary decimal inputs without a custom app, and whether cart-level price overrides are supported for this use case.
Key terms: Metafield (custom field storing product data), GraphQL (API query language).
Hey @Cindy29
One approach would be to set the price as ‘per meter’ and then treat the quantity (user input) as the number of meters. This would also eliminate the external request - would this suit?
Yes I thought of that, but I need lengths in decimals (0.25m, 0.50m, 0,66m
…).
Any input can be valid.