I have a page which uses a short code to display all products meeting a set of product categories. I would like to include a button/link to add all these items to the viewer’s cart. Is there a way to make this happen? I am not adverse to a custom function. I have not found anything which would either add all items displayed on a page to the cart nor one which would add all items matching categories to a cart. It would need to match all of multiple categories. I have found various php functions to allow for manually listing multiple items to a URL, separated by commas, but would prefer an automated method.
Url Sample of custom function:
...cart/?add-to-cart=9120,9172,9175,9178,9181,9184,9188,9191
Short code: