Automatically Add The Same Quantity of a Addon Product To Match The Quantity of Another Product

$75.00
Quick Demo

This code adds a product to the cart when another product is added and matches the quantity. Example :

  • If 1 product named A is added to cart, another (addon ) product named B will be added.
  • If 5 products named A are added to cart, 5 ( addon ) products named B will also be added.

The addon can be a free product or a paid product, it doesn’t matter.

Demo Video

Shows a product quantity of 5 demo products added to the cart which auto adds 5 addon products based on the product I.D added to the input field for the main product.

Tested using the Twenty Twenty default theme for WordPress however will work in any WordPress theme running WooCommerce.

Installation

Copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.

You can then grab the product I.D for your addon product to the input field on the edit product screen as seen in the demo video.