How to Offer a 50% Discount on Every Third Purchase of Product A in WooCommerce?
This customization is helpful when the store owners want to spike up the sales of a particular product by offering deals in a consistent pattern of BOGO-like discounts. This code will let you to add a 50% discount to product A on purchase of every 3rd item of product A, and the discount amount increases by 50% of the product price for every 3rd item added to the cart
add_action(‘woocommerce_cart_calculate_fees’, ‘ts_custom_discount_based_on_logic’, 10, 1); function ts_custom_discount_based_on_logic($cart) { if (is_admin() && !defined(‘DOING_AJAX’)) return; // YOUR SETTINGS: $targeted_product_id = 54; // Set HERE your targeted product ID // Initializing variables $discount = $qty_notice
This is the first part of the article
How to Offer a 50% Discount on Every Third Purchase of Product A in WooCommerce?
