Magento - How to Edit container1

Magento - How to Edit container1

August 26, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - How to Edit container1

Editing Container1 and Container2 Product Options in Magento

As an experienced Magento developer, I often receive queries about customizing product options within the Add to Cart area of the frontend template. In this post, we’ll dive into a common scenario where you want to modify the container1 and container2 elements that contain product configuration options.

Understanding the Product Options Structure

In Magento, the product options are rendered using layout XML files located in app/design/frontend/<vendor>/<theme>/layout. The relevant file for our discussion is typically named catalog_product_view.xml.

Within this layout XML, you’ll find the following structure:

<reference name="content">
    <block type="catalog/product_view_options" before="-" template="catalog/product/view/options.phtml"/>
</reference>

The product_view_options block renders the product options using the view/options.phtml template. This template is responsible for creating the container1 and container2 elements that hold various product options like ‘Size’, ‘Color’, or ‘Additional Options’.

Editing the Product Options Template

To customize the product options, you need to locate the view/options.phtml template file in your active theme. By default, it lives under app/design/frontend/<vendor>/<theme>/template/catalog/product/view/.

If this directory doesn’t exist in your current theme, don’t panic! You can simply copy the file from the base theme (usually located at lib/internal/Magento/Theme/frontend/base/default/template/catalog/product/view/options.phtml).

Once you have the template in your active theme’s directory, you’re ready to make modifications. Here are a few examples:

  1. Adding a New Div Class: To add a new div class around the options container, locate this line in view/options.phtml:

    <div id="product-options-wrapper">
        <?php echo $this->getProductOptionsHtml() ?>
    </div>
    

    Modify it to include your desired class:

    <div id="product-options-wrapper" class="custom-options-class">
        <?php echo $this->getProductOptionsHtml() ?>
    </div>
    
  2. Adding New Options: To add a new option, you’ll need to modify the catalog/product/view/options.phtml template and ensure the new options are defined in the product backend.

  3. Overriding the Template: Remember that changes made directly to core files will be overwritten during upgrades. To prevent this, consider creating an extension for your theme using a module structure as recommended by Magento’s best practices.

Conclusion

Editing container1 and container2 in Magento involves understanding the layout XML and product option rendering process. With a clear knowledge of where to locate and modify the relevant template files, you can easily customize the Add to Cart area according to your design needs.

For a more comprehensive guide on extending Magento themes and creating custom layouts, I recommend checking out this detailed tutorial by Laravel Company: How to Create a Custom Magento Theme.

Remember, proper theming practices ensure your code remains safe from upgrade-related issues. Always strive for clean, organized extensions that follow the Magento coding standards.

Happy customizing!

Checkout Catalog Themes Configuration

Our network