How do i add product option or a variant that increments the price - shopify? - 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.

Related

Display RRP price through variant metafield based on variant selected - Shopify

I'm running a rental store on Shopify and want to display a RRP/buyout price based along with the monthly price that's already displayed. Some variants for a product have different buyout prices and these are stored on the variant ID.
I've tested a few different codes that will display the buyout price, but they don't automatically update when a different variant is selected from the drop down menu. They do if I refresh the page.
I'm using the Envy theme.
Thanks!

Dynamic Variant Price while adding variant into the Shopify cart

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

Shopify - auto-tagging by 'compare at price' difference

The shopify store I edit has a 'sale' collection. This consists of products which have been auto-tagged on the condition that the 'compare at price' is higher than the actual price.
I want to create a new 'clearance' section, which would consist of products where the actual price is cheaper than the compare at price by 50% or greater. I can't find a simple way to do this (i.e. by using the inbuilt collection creator).
Can anyone help me out?
Discounts are applied at the checkout, not when browsing a product. That is why the Smart Collection logic has no conditions based on discounts. If I were you I would try and work out how to build a collection "clearance" with conditions that make sense, and then you could create a price rule/discount that would apply to that collection (50% off). It seems like that is the way to go.

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.