0

I want to show my custom attribute on the wishlist sidebar section, how to add my custom attribute "brand & Size" attributes into this,

eg:

<div data-bind="html:product_brand "></div> 

Brand is my attribute, its not showing,

 <div data-bind="html: product_price"></div>

price is showing, how to display my brand attribute.

I want to add attribute : brand & size

1 Answer 1

1

To use any custom attribute in the knockout, you need to add them in customerData

Check Method getItemData of Class Magento\Wishlist\CustomerData\Wishlist,all the product attributes used in knockout part are defined here. You need to add your required attributes with key to the final returned array, to use it in phtml.

7
  • path : C:\xampp\htdocs\m3\vendor\magento\module-wishlist\CustomerData\Wishlist.php code: codeshare.io/2KzpMK where i can include my brand attribute.
    – zus
    Commented Apr 9, 2021 at 8:55
  • in the same array where product_name is added, Line no 154-171
    – Piyush
    Commented Apr 9, 2021 at 8:57
  • 'product_name' => $product->getName(), how to add my brand attribute?
    – zus
    Commented Apr 9, 2021 at 8:59
  • try this community.magento.com/t5/Magento-2-x-Programming/…
    – Piyush
    Commented Apr 9, 2021 at 9:02
  • is it right codeshare.io/5XkV1k
    – zus
    Commented Apr 9, 2021 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.