PrestaShop

PrestaShop Product Weight: How to Display Custom Fields on Your Product Page

PrestaShop community
PrestaShop community

Mastering Product Data: Displaying Custom Weight Fields in PrestaShop

As e-commerce experts at Migrate My Shop, we frequently encounter merchants seeking to enhance their product pages with specific, often nuanced, information. A common request, perfectly encapsulated by a recent PrestaShop forum query from Guylaine Pigeon (Thread #1105194), revolves around displaying a product's actual weight directly on the product page, distinct from the weight used for shipping calculations.

This seemingly simple requirement highlights a crucial aspect of online retail: providing comprehensive and transparent product information. While PrestaShop inherently manages product weight for shipping, many businesses need to communicate the item's physical weight for various reasons – be it for consumer clarity, specific product types (e.g., food, jewelry, craft supplies), or even regulatory compliance.

Why Distinguish Display Weight from Shipping Weight?

  • Customer Transparency: Shoppers appreciate knowing exactly what they're buying. A product's physical weight can influence perceived value, quality, or even how they plan to use or store it.
  • Product Specifics: For items sold by weight (e.g., gourmet foods, precious metals) or where weight is a key characteristic (e.g., lightweight travel gear vs. heavy-duty tools), displaying this information is vital.
  • User Experience: Clear, concise product data reduces customer queries and builds trust, leading to better conversion rates.

Solution 1: Leveraging PrestaShop's Built-in Features (The Easiest Path)

The most straightforward and often recommended solution, as suggested by Eolia in the forum thread, is to utilize PrestaShop's native "Features" functionality. This powerful tool allows you to define specific attributes for your products without any coding.

Step-by-Step Guide to Using Features for Product Weight:

  1. Access Features: Log into your PrestaShop admin panel. Navigate to Catalog > Attributes & Features.
  2. Create a New Feature: Click on the 'Features' tab, then 'Add new feature'. Name it something descriptive like "Product Weight" or "Net Weight". Save it.
  3. Add Feature Values: Now, click on the newly created feature. You'll need to add specific weight values that your products might have. For example, click 'Add new feature value' and enter "100g", "250g", "1kg", "5kg", etc. Repeat for all necessary values.
  4. Assign to Products: Go to Catalog > Products and edit the desired product. In the product editing page, navigate to the 'Features' tab. Here, you can select your "Product Weight" feature and choose the appropriate value from the dropdown list you created.
  5. Display on Front End: By default, PrestaShop themes typically display features in a dedicated "Data Sheet" or "Product Details" tab on the product page. This makes the information readily available to your customers.

Pros of using Features: No coding required, easy to manage, native PrestaShop functionality, compatible with most themes out-of-the-box. Cons: Limited formatting options, might not suit highly dynamic or calculation-intensive weight displays.

PrestaShop admin panel showing the creation of a 'Product Weight' feature and its values.
Illustration: Setting up 'Product Weight' as a new feature in the PrestaShop back office.

Solution 2: When Built-in Isn't Enough – Custom Module Development

While features are excellent for static data, some scenarios demand more advanced control. If you need specific formatting, dynamic calculations, integration with external systems, or a display location outside the standard feature block, a custom module might be necessary. This is where the forum's second reply, requesting the PrestaShop version and theme, becomes critical, as custom development is highly dependent on these factors.

When to Consider a Custom Module:

  • You need the weight field to be editable in a specific way (e.g., with unit conversion).
  • The weight needs to be used in custom calculations on the front end.
  • You want the weight to appear in a unique location or with custom styling not achievable via CSS alone.
  • Integration with a third-party inventory or ERP system that manages product weight.

Technical Overview for Custom Development:

A custom module would typically involve:

  • Database Modification (Optional): Adding a new column to the `ps_product` table if the data needs to be stored independently of features.
  • Back Office Controller Override: Extending the `AdminProductsController` to add a new field to the product edit form.
  • Front Office Hooking: Using PrestaShop hooks (e.g., `displayProductExtraContent`, `displayProductButtons`) to inject the custom weight data into the product page template.
  • Smarty Template Modification: Editing the `product.tpl` file (or your theme's specific product template) to display the new field using Smarty variables.

{if isset($product.custom_display_weight) && !empty($product.custom_display_weight)}
  

Net Weight: {$product.custom_display_weight}

{/if}

This approach offers maximum flexibility but requires strong PHP, Smarty, and PrestaShop module development skills. It's a more significant investment but provides tailored solutions for complex needs.

A PrestaShop product page displaying a custom 'Net Weight' field below the product description.
Illustration: A custom 'Net Weight' field displayed prominently on a PrestaShop product page using a custom module.

Crucial Considerations for Any Approach: PrestaShop Version & Theme

As 'Prestashop Addict' rightly pointed out in the forum, your PrestaShop version (e.g., 1.6, 1.7, 8.x) and active theme are paramount. These dictate:

  • Admin Interface: The navigation and layout for managing features or installing modules can vary significantly.
  • Template Structure: The `.tpl` files responsible for rendering the product page differ across versions and themes. Custom code or module integration must target the correct file paths and Smarty variables.
  • Module Compatibility: Not all modules are compatible with all PrestaShop versions. Always check compatibility before installation.
  • Theme Overrides: If your theme has overridden core PrestaShop templates, you'll need to modify the theme's specific files, not the core ones, to ensure your changes persist and are upgrade-safe. Using a child theme is always recommended for such customizations.

PrestaShop Migrations and Custom Fields

For businesses considering a migration to or from PrestaShop, managing custom product fields like display weight is a critical data integrity point. When migrating, ensuring that these custom attributes are accurately mapped and transferred to the new platform or PrestaShop version is essential. Whether they are stored as features or custom database fields, a robust migration strategy must account for them to prevent data loss and maintain a consistent customer experience post-migration.

Conclusion: Empowering Your PrestaShop Product Pages

Displaying a product's actual weight, separate from its shipping weight, is a valuable enhancement for many PrestaShop stores. For most merchants, PrestaShop's built-in "Features" provide an elegant, no-code solution. For more complex requirements, custom module development offers unparalleled flexibility, albeit with a greater technical investment.

Regardless of the chosen path, understanding your PrestaShop version and theme is key to a successful implementation. At Migrate My Shop, we specialize in navigating these complexities, ensuring your e-commerce platform is perfectly tailored to your business needs, whether it's a simple product page tweak or a full-scale migration. Don't let data challenges weigh down your online success – reach out to us for expert guidance!

Share:

Start with the tools

Explore migration tools

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

Explore migration tools