Using multiple instances on one page (like pizza delivery websites)
-
Hello,
I am building a WooCommerce theme with timber and your plugin, like those pizza delivery websites, where there is no classic product archive and single pages and all products are displayed underneath each other on one single shop page.
This led me to the problem, that the first listed product always had the product options block, that the last listed product with option blocks has assigned.
I did some research and found out it is happening because the ‘yith-wapo-reload-addons’ trigger function in front.js is building its serialized Addons data block with
var addons = jQuery('form.cart').serializeArray();
which results in getting ALL form.cart instances and then using the last ones data for the AJAX request.I changed this to
var addons = jQuery(this).serializeArray();
so that the function always uses the input fields found inside the current cart.So far I have not found any problems with this solution for my problem.
Maybe this helps somebody who is doing the same as I am doing or the plugin devs can put it into the next update, if it is not causing any problems with other setups.HTH
- The topic ‘Using multiple instances on one page (like pizza delivery websites)’ is closed to new replies.