define([
'jquery',
'uiComponent',
'Magento_Customer/js/customer-data',
'domReady'
], function ($, Component, customerData) {
'use strict';
return Component.extend({
/** @inheritdoc */
initialize: function () {
var _this = this;
this._super();
this.wishlist = customerData.get('wishlist');
console.log(this.wishlist);
this.wishlist.subscribe(function(newValue) {
_this.decorateItems();
});
_this.decorateItems();
},
decorateItems: function() {
var items = this.wishlist().items;
if (typeof items === 'undefined' || !items.length) return;
$('a.action.towishlist').each(function(){
var data = $(this).data('post'),
i;
for (i = 0; i < items.length; i++) {
if (data.data.product == items[i].product_id) {
$(this).addClass('selected');
$(this).css("pointer-events","none");
console.log(items[i].product_id);
}
}
});
}
});
});
above is my code to get customer wishlist item in js but its always return last 3 items even there is 6 items in wishlist but this script showing only 3 items
i also treid change
namespace MagentoWishlistCustomerData;
const SIDEBAR_ITEMS_NUMBER = 3;
and change it to 6 but nothing happend?