How to add different dimensions in product?

Viewed 158

Hello Shopify Developers.

I'm a newbie on Shopify. How can we add a tab in product pages as Dimensions? Through this tab, we should be able to edit and change the dimensions for each specific product.

Would you give me a suggestion to do that? please teach me.

Best regards, Siva.

1 Answers

Shopify is not designed to allow customers to enter custom dimensions and have that affect the final price of the item.

However, this can be accomplished in principle through some roundabout steps, which involve a hidden priced product and a fair bit of javascript and the use of line-item properties to link everything together.

If you're feeling ambitious and want to make such a system yourself, the basic flow would be:

  • Create a product that either has a $0.01 value (or whatever the lowest denomination is in your currency) or a value of whatever the cost-per-smallest-unit that you want to sell by
  • Update your store templates so that any products that are marked as a component product (via tags, metafields, product type, or whatever you choose to go with) do not get displayed on collection pages, search results, etc.
  • For your product pages that need custom dimensions, you will need to create any relevant input fields and add whatever formulas you need to convert user inputs into units of your component product
  • When the item is added to cart, you will need custom javascript to add the correct quantity of the component item at the same time that the main/visible item is added to the cart. At this step, I would recommend adding line-item properties to both items that would identify that they belong together.
  • You will need to update your cart to hide the component product and add its price to the main/visible item for display purposes, and the quantity-update and item-remove features in your cart to make sure that when the main/visible product is updated or removed the component product is updated appropriately as well.

This can be quite the undertaking to try to take on yourself, so if any of the above steps seem daunting I would strongly recommend looking for an app in Shopify's app store that can do these steps for you. There are a lot of product option/customization apps available, and many of them have free trials that you can take advantage of to see if they meet your needs.

Of course, if you have the skills and ambition to take this project on, great! The above flow should hopefully get you started, and if you need further advice on any specific step feel free to ask another question.

Related