Answers for "woocommerce apply coupon with add to cart"

0

woocommerce apply coupon with add to cart

function wc_ninja_apply_coupon( $coupon_code ) {
	if ( 'test_code' === $coupon_code ) {
		$product_id = 99;
		WC()->cart->add_to_cart( $product_id );
	}
}
add_action( 'woocommerce_applied_coupon', 'wc_ninja_apply_coupon' );
Posted by: Guest on November-02-2020

Code answers related to "woocommerce apply coupon with add to cart"

Browse Popular Code Answers by Language