cancel
Showing results for 
Search instead for 
Did you mean: 

How can I programmatically access the customizable options of my products in the Magento 2 cart?

How can I programmatically access the customizable options of my products in the Magento 2 cart?

I am writing a shipping plugin for my Magento 2 store.  I need to access the values of the customizable options of my products that are in the cart.  For example, Product 1 has customizable options of width and height (NOTE: they are NOT attributes - they are customizable options).  I need to programmatically read these values so I can use them in my shipping algorithm.  How can I do this?

1 REPLY

Re: How can I programmatically access the customizable options of my products in the Magento 2 cart?

hi @slovejoy

 

 If you option is set for cart then you can simple follow this code

 

<?php echo $_item->getOptionByCode('custom')->getValue(); ?>

 

Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti