Custom Product Dimensions in Shopify: Calculating Square Footage & Pricing

Handling Custom Sizes and Pricing in Shopify: A Community Dive

Ever run into a situation where Shopify's built-in pricing logic just doesn't cut it? You're not alone! We recently had a fascinating discussion in the community about this very issue, specifically around selling products with custom dimensions, like printed items where customers need to specify their own sizes. It's a common challenge, and figuring out the right approach can be tricky.

The original poster, 031999, was looking for a way to let customers input dimensions (e.g., 24" x 36") and have the system automatically select the correct price variation based on the calculated square footage. They were already using Globo Product Options, which is great for standard variations, but couldn't quite handle this dynamic calculation.

The Challenge: Shopify's Limitations and Customization Needs

As 031999 pointed out, Shopify's pricing logic has limitations. You can't directly input arbitrary dimensions and expect the system to magically calculate the price. The core issue is mapping customer-defined dimensions to a specific, pre-defined variation with its associated price.

One suggestion from Maximus3 involved diving into the theme code. Here's what they said:

You can get inside the theme and manipulate the code to suit your need.

You could ask Sidekick to give you a script that does the math and basically do whatever you want it to do. Then you place the script in the main-product.liquid file or product-form.liquid file, or in a custom liquid section in the theme editor.

Shopify is made for exactly this. You have a need for custom sizes and prices. Shopify gives you control over the theme files, and even provides a AI tool that can give you the code.

While this is technically true – Shopify does offer theme customization – it might be daunting for store owners who aren't comfortable with coding. Plus, relying heavily on custom code can make your theme harder to maintain and update in the long run.

Exploring App-Based Solutions

031999 was specifically looking for an app-based solution, and that's often a good starting point. Here's the core problem they were trying to solve with an app:

Essentially if a customer chooses 24” on a dropdown menu, and 36” on the other dropdown, the app can understand go choose the “6 Square Feet” variation and apply it at checkout.

The ideal app would take the two dimensions entered by the customer, calculate the square footage, and then automatically select the corresponding variation in Shopify. Think of it as a dynamic bridge between customer input and Shopify's variation system.

Possible Approaches and App Considerations

While the thread didn't pinpoint a single perfect app, it highlights a few key strategies and considerations:

  • Square Footage Groups as Variations: 031999 was already using this approach, creating variations like "6 Square Feet" and assigning prices accordingly. The challenge is automating the selection of the correct variation.
  • Custom Product Creation: The idea of an app that creates a new custom product for each unique dimension combination is interesting, but could quickly lead to a massive product catalog. It's probably best to avoid this if possible.
  • JavaScript and Theme Customization: You could use JavaScript to capture the dimensions, calculate the square footage, and then update the selected variation. This would involve modifying your theme's code, potentially using the theme editor's custom liquid sections as suggested by Maximus3.

Instructions for a JavaScript-Based Solution (Advanced)

If you're comfortable with code, here's a general outline of how you could approach this with JavaScript:

  1. Add Dropdowns for Dimensions: Use your theme editor or a product options app to create two dropdown menus for customers to enter the dimensions (e.g., "Length" and "Width").
  2. Capture Dimension Values: Use JavaScript to listen for changes in the dropdown menus. When a customer selects a dimension, store the value in a JavaScript variable.
  3. Calculate Square Footage: Once both dimensions are entered, calculate the square footage. Make sure your units are consistent (e.g., inches, feet).
  4. Map Square Footage to Variations: Create a JavaScript object or array that maps square footage ranges to your Shopify variations (e.g., `{ 6: "6 Square Feet", 12: "12 Square Feet" }`).
  5. Select the Variation: Use JavaScript to programmatically select the correct variation based on the calculated square footage. This might involve finding the variation's ID and triggering a change event on the variation selector.
  6. Add to Cart: Ensure the "Add to Cart" button works correctly with the dynamically selected variation.

Important: This is a complex solution that requires JavaScript and Shopify theme development experience. Test thoroughly in a development environment before deploying to your live store.

Wrapping Up: Finding the Right Fit

Ultimately, the best solution depends on your technical skills and the specific requirements of your store. While a dedicated app would be ideal, a combination of existing apps (like Globo Product Options) and custom JavaScript might be necessary to achieve the desired functionality. Don't be afraid to experiment and test different approaches to see what works best for you. And remember, the Shopify community is always there to offer advice and support!

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools