How to automatically add a WooCommerce product to cart on page load

WooCommerce recommends to automatically add a product to cart with a code snippet you can add to your (child-)themes functions.php: This code works fine and is probably everything most shop owners need. But there is a scenario where this code doesn’t work or at least isn’t a good solution. The code always adds the

Read more