Dynamic Variant Price while adding variant into the Shopify cart - shopify

I have Shopify Store, where customer can design/customise their product before buying it. and based on the design / customisation price of the selected variant may get varied. but I think Shopify does not facilitate to change variant price dynamically while adding into cart.
Is any solution there I might be missing ? Any help will be appreciated.

There are a few solutions none of which are great.
Quantity based
Make the product price $1 and based on the options increase the quantity in order to meet the required price. With a little code you can change the cart to look like it's a single product, but the checkout will not be OK.
Variant based
If the product will have only a few price changes you can create different variants and change the variants based on the selected options. For example 10 different variants for 10 different prices.
App based
You can use an App such as https://apps.shopify.com/product-options to create options that can modify the product price. ( this will add dummy products to the checkout as well )

For Plus, you can use shopify script to edit the line items directly.
If you're not Plus users, you have to do it on server-side, i.e. your backend
submit an ajax request on your custom product page
backend receives the request. Use admin API to create a new product variant on the fly
set the variant price, weight, quantity, or other properties based on your business rules
return response to client
client receives a successful response. use cart ajax to add the new variant to cart
let client continue checkout
Upon order is made, use webhook to update inventory or other information required. But there is a problem regarding variant limit. For each product, you can only add 100 variants.
So you need to create new products when the variant is used up for the product. Alternatively, you can delete the existing variants. But the variants in customer carts will be cleared.
I am doing something similar to what you're doing so I think our approach will be more or less the same. Basically, there are only 2 solutions, either create a new product or new discount dynamically. Both approaches create many dummy/garbage data

Related

Can we increase shipping rates in shopify using shopify script?

I found similar question in the forum, and from this answer I come to know about Career service. Which looks promising initially, but after reading the doc from here, I found that there is an issue for my use case.
This is my use case:
There will be multiple items in the cart with different delivery dates set(I store delivery dates in the line_item property)
now when user go to checkout the shipping rate has to be calculated based on the delivery dates(which are stored in the line item property for each line item)
shipping price should be calculated like ...... if there is only one delivery day, we need to offer x price, if there are two different delivery dates we need to offer 2x price and so on....
so the issue is, Carrier Service uses Server side cashing and it will only ask for price if any of these(variant IDs, default shipping box weight and dimensions, variant quantities, carrier service ID, origin address, destination address, item weights and signatures) field change. It doesn't include line item properties(where I have stored delivery dates).
I have also checked the shopify scripts from here, but after some mockups I come to know that we can only provide discount to the existing shipping rates and can not add new shipping method, or increase shipping price for existing shipping method.
Please help me to find a solution for this problem.

How do i add product option or a variant that increments the price - shopify?

I'm creating a custom feature on a Shopify theme and I need to add product options or variants that each increment a price by a certain amount.
For example, if I want to have wrapping on a product, that costs 10$ extra. I don't want to create a "wrapped" variant that costs product price + 10$, I want it to be dynamically calculated because I will be adding multiple such choices.
I then need to add the product to the cart via the Shopify AJAX API, so I will be needing to specify such added options in the request body somehow and have Shopify calculate the final price.
How would I go about doing this?
Prices in Shopify are attached to variants.
To say it simply you can't modify the price of a variant in any way. The price is set on creation of the variant and you can't modify the variant price from the front-end.
If you plan to modify the price based on the user input you need to create predefined variants for each option and change the selected variant based on the user input.
If you still want real dynamic price you will need to look for some kind of an App that will support this functionality.

Shopify Storefront API Get Order Line Item price

I'm currently working with Shopify Storefront API and been struggle with this problem lately.
So when you get OrderLineItem from an Order from the API it only return
title
quantity
variant(product's variant)
It does not contain any information about the line item's price.
For example: i have an OrderLineItem with a product variant had 137$ as price by the time i created the order. Then i update the product's price to 138$. The OrderLineItem's price remain $137 which is correct but the StorefrontAPI does not return any information about the OrderLineItem 's price. Is this a bug or does anyone know where can i find this piece of information ?
What are you trying to do? You cannot change the price of a product already booked to an order for one thing. You can use the regular API to access a product, and change pricing, but that has nothing to do with the Storefront API.

How to set custom price for products on the basis of quantity in shopify?

Greetings.
I am working on a eCommerce website based on shopify. And for product I want to set a custom price. For example, The standard price of product is $500 but price will vary if user increased the quantity i.e. On 5 - 10 it will cost $450, On 11 - 15 it will cost $400 and on 20+ quantity it will cost $300.
I have searched module for this and also found a module i.e. https://apps.shopify.com/quantity-breaks. But its working on the basis of "Percent" that I don't need. Because I want to place price manually on the basis of quantity.
So please help me out from this and provide your valuable thoughts on the same.
Thanks in advance.
The way this is generally done in Shopify is to create variants where the option values are the price breaks. You have to modify your theme so that when a Qty > price break is entered the product page selects the variant that corresponds to that price level.
Other than the coding portion of this the main issue becomes inventory management since Shopify treats each variant as a separate inventory item but if you use variants to manage price breaks they are not actually separate items.
I think the easiest way to do this would be with a Shopify App. There are many that have price breaks etc. and they are usually easier to set up than using variants as the price break amounts.

Edit Shopify Metafields/Product Options

I'm using Shopify to run a sort of Kickstarter campaign on a custom product, whereby if the goal is reached the item will be made. I need to update the number of the items sold during the campaign, I'm storing the number sold as either a product option or metafield however right now i'd have to update these values manually every time one is sold.
My question is whether or not I am able to edit the value of a product variant option or metafield preferably using liquid - so that on completion of the order I can update the number of sold items.