• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout
  • Cart
  • Videos

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

$75.00

Demo Video
Category: WooCommerce
  • Description

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.

Primary Sidebar

Cart

Code written by Brad Dalton specialist for WooCommerce with more than 10 years of experience.

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Account
  • Checkout
  • Cart
 

Loading Comments...
 

You must be logged in to post a comment.