Relative Content

Tag Archive for phpajaxwordpresswoocommerceproduct

WooCommerce custom Mini-Cart including a products slider with Add To Cart issues

I’m doing some customisation to the mini-cart. When a user adds a product to the cart, inside the mini-cart I’m creating a slider containing the added product’s cross-sales. So for example, user adds Product A that has cross-sales products X, Y, Z. Once his mini-cart opens he sees a slider with these products and a button to add them to the cart. The problem I’m having is that the add to cart button is not working.. I have enabled ajax add to cart and I’m noticing that only one product is getting url /?wc-ajax=add_to_cart&add-to-cart=productID, which on click just loads a white screen.. The other products in the slider have urls ?add-to-cart=productID, which on click just reloads the page and returns empty cart.. So none of the add to cart buttons is working.. In mini-cart.php, I have this code that creates the slider: