Displaying Magento Custom Option Values on Shopping Cart Page
Are you struggling to display custom option values chosen by customers next to your product names on the shopping cart page? In this guide, we’ll walk through how to extract and display these values using native Magento functionality.
Understanding Magento Custom Options
Magento allows you to add custom options to products for additional configuration. These are different from attributes in that they provide more flexibility but are not searchable or used in filtering. Common examples include color choices, sizes, or add-on services like engraving or gift wrapping.
By default, Magento only displays the option name (like “Color”) and the price adjustment on the cart page. The actual selected value (like “Gold” or “Silver”) is not visible without digging into individual line items.
Display Custom Option Values in Cart
To display custom option values next to product names in the cart view, we’ll need to modify the sales_order_view_index.xml layout and create a new template file. Here’s a step-by-step guide:
-
Create a new template file: In your theme directory (or child theme), navigate to
app/design/frontend/<Vendor>/<Theme>/template/sales/order/viewIf the folder doesn’t exist, create it manually.
-
Add a new XML element for custom options
Open
/app/code/core/Mage/Sales/etc/config.xmland add the following code within<sales> -> <global>:<layout> <updates> <custom_options_in_cart translate="label"> <label>Custom Options in Cart</label> <file>sales/order/view/items.phtml</file> </custom_options_in_cart> </updates> </layout> -
Create the template file
Create a new PHP file named
items.phtmlinside your order view folder:<?php if ($item->getHasOptions()): ?> <p><strong>Custom Options:</strong> <?php foreach($item->getOptions() as $option): ?> <?php echo ' '. $option->getTitle() . ': '. $option->getValue(); ?> <?php endforeach; ?></p> <?php endif; ?> <!-- Rest of the default items.phtml content --> -
Flush cache and check
After making these changes, flush your Magento cache using
bin/magento cache:flushorphp bin/magento cache:flush. -
Update your product’s custom option configuration
Make sure to select “Display on Product View Page inline” for each of your custom options in the backend.
Conclusion
By following these steps, you should now see your custom option values clearly displayed next to the corresponding products in the cart view for both frontend and backend customers:

Remember that this solution assumes you’re using a standard Magento 1.x installation. If you have any extensions or customizations, they may require additional modifications.
For more advanced customization options, consider exploring our guide on Extending Magento Layouts for a deeper understanding of the layout system.
Happy coding!