0

Provided solution here Woocomerce Remove a specific cart items when adding to cart another specific items - If I understood correctly, this code helps in the case where I want to check whether one of the products 31 or 32 has been inserted and then remove product 37, and check whether one of the products 33 or 34 has been inserted and remove product 53. Did I understand correctly?

What happens if I have several bundle products, each of which contains X certain products, and I want to check if the bundle product has been placed in the cart, and if all the details it contains have been removed from it (because they are already included in it).

For example: I have many products on the site - Products A, B, C - in package #1 Products P, Q, X, Y, Z - in package #2 and products M, Y, Q, N - in package No. 3 The number of packages is not limited and the amount of products in each package is not fixed.

I want that as soon as you place a package, if the individual products included in it are removed from the basket so that there is no duplication in the basket. If there is a way to pop up a message to the customer with a question like "The selected package already includes products A and B, do you want to remove them from the cart?" - That would be great.

The question is whether it is possible to improve the code in a convenient way to fit several sets of packages without having to copy-paste and change every time a new package is added. But there should be a defined place in the code for adding the list of products, and a defined place for adding the list of packages, and the script would know how to run the test accordingly

I tried using the code that appears here: Woocomerce Remove a specific cart items when adding to cart another specific items

But it is limited to the number of packages and products

0 Answers0