Hello,
The code below allows to refresh the product reference if the customer changes the color or the size.
prestashop.on( 'updatedProduct', function (event) { updateReference(); } ); function updateReference() { ref = $('#product-details').data("product").attributes; if(ref) { for (var i in ref) $('#reference_product').html(ref[i].reference); } }
Unfortunately the code below, which is placed in custom.js does not work on prestashop 1.7.8, we have the error :
Uncaught TypeError: Cannot read properties of undefined (reading 'attributes')
We use the following theme : http://ps.ariestheme.com/themes/sp_autostore/fr/
Would you have a solution for me ?
Could you help me to correct?
Sorry for my English and thank you in advance.