Basically what I want is the price on the product page to change according to the weight

While adding a product, i also add weight of the product. So there is a price of product lets say X, and according to weight product price will varry (weight will be defined while adding product). Lets say we if it is 100g the price Y should be added in product cost X. Now the total cost of the product will be X+Y. Customer can not choose the option of weight. They only can see the weight of the product.

I have option of weight like 100 grams: usd6.4; 200 grams:usd7.8; 300 grams:usd9.1; 400 grams:usd10.5; 500 grams:usd11.9; 600 grams: usd13.3; 700 grams: usd14.6; 800 grams:usd16; 900 grams:usd17.4; 1kg : usd18.8

How can you not let the customer choose the amount the customer wants to buy.

The easiest way here is to create a weight variant with your defined values and prices.

Hello,

Could you please clarify the following?

  • Are you creating separate products for each weight option, or are you adding weight as a variant under a single product?

    To adjust product prices based on weight, we can create a product metafield to store weight and its corresponding price. When the product is added to the cart, we can use the Cart Transform API to modify the product price dynamically based on the weight.