Normally, custom products don't have predefined weights. Therefore, merchants cannot use the weights in Shopify product settings while using the Custom Price Calculator app.
To enable merchants to use the Shipping feature in Shopify, the Custom Price Calculator allows you to calculate the weight of your products through a formula just like the
Let us explain by an example of a Rug Store selling rugs of different sizes
As shown in the image below, we will add three number-input elements to capture the length, width, and quantity from the customers.
To enable weight calculation through the calculator, enable the toggle that says "Variant weight Calculation". This will ensure, that the variant generated by the calculator will follow the weight calculation that you have defined within the calculator. (Our app generates variants each time add to cart is clicked. To know more, please read How the calculator works with Variants)
Please note: The weight calculated would be in the unit selected in the Shopify Product settings. Refer to the screenshot below taken from the Shopify product settings page.
Coming back to the calculator; Once you have enabled the toggle "Variant weight Calculation". You will get to see a formula field where you need to define your weight calculation logic. Please note that this formula is different from the main pricing formula but follows the same approach, allowing you to use different element names to calculate the weight.
In the case of rugs, let's assume that the weight is 1/5th (one-fifth) of the total area (square inch) of the rug material ordered. In this scenario, the formula for weight calculation would be "Length x Width x 0.2" where 0.2 represents the fraction 1/5.
Now if we jump to the product page using the calculator, the customer provides the inputs for Lenght and Width in inches and gets the price calculated which is defined by the merchant based on his/her pricing logic/formula.
Now, when the customer clicks on add to cart a variant is created in the Shopify product settings. As you can see in the screenshot, a new variant with a name "Default_cpc_xxx" is generated with a price of $750
When you click on the variant name to check the details, you shall see that it has a weight assigned based on your weight calculation logic - length x width x 0.2. So, as per the dimensions provided by the customer, the weight comes out to be - 50 x 30 x 0.3 = 300 lb.
Please note that the default weight defined for the product will remain unaltered and have no effect on the weight of the variant. Only the unit for weight measure (in this case "lb") would remain the same.
Finally, when the customer goes to the checkout page and enters the shipping address. The total shipping price will be calculated based on the distance (Address) and the weight that comes from the calculator.