🔥 Just Launched! Werra Premium Template for HyväSee it in Action

Add Magento 2 Attribute Values Before Add to Cart Button in Product Page

By Sanjay JethvaUpdated on May 22, 2025 3 min read

Magento 2 store owners should not overlook the product page design.

It can either makes or breaks the sale. It is the content in your store that will be shared the most. It must be simple, easy to understand, and encourage the shoppers to purchase.

Whenever you create a Magento 2 attribute, the default method displays the product attributes and their values under the “More Information” tab. To view them, users have to scroll down to it.

Here’s where you can find it:

Before-Implementation-Default-Magento-View

Better way to do this is to add Magento 2 attribute values before the add to cart button in product page.

Once you implement the method given below, the product page design is optimized so that the users do not need to scroll till the end of the page to check the details of the product. The product attributes and its values can be directly accessed just above the “Add to Cart” button. The advantage here is that a potential customer is prompted to add the product to the cart immediately after having a quick look at the details. Improve your product page to speed up the purchase process!

Here’s what the end results will look like:

Product-Attributes-And-Values-before-Add to cart-button

Now that you know how the trick is useful to optimize the product page, take a look at its implementation too!

Code to Add Magento 2 Attribute Values Before Add to Cart Button In Product Page:

Place the below code at app\design\frontend\[Theme]\Magento_Catalog\templates\product\view\addtocart.phtml

<php $layout = $block->getLayout();
echo $layout->renderElement('product.attributes');
?>;

Can it be easier?

Happy Optimization!

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.