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' );

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
woocommerce insert coupon field in cart apply coupon hook woocommerce woocommerce set per cart coupon woocommerce coupon from cart page relocate woocommerce coupon from cart page change woocommerce add coupon to cart programmatically woocommerce add couponto cart programmatically woocommerce add discount to cart programmatically apply coupon programmatically after registration woocomerce woocommerce apply coupon to registration woocomemrce coupon apply programatically woocommerce coupon code shopping cart woocommerce add coupo to cart woocommerce add cart discounts add coupon code in woocommerce add coupon code woocommerce apply coupon to product turn into sale woocommerce how to add a coupon to woocommerce how to add coupon code in woocommerce woocommerce add coupon add coupons woocommerce woocommerce programmatically apply coupon woocommerce apply discount on cart woocommerce how to add coupons to cart apply coupon to category woocommerce apply coupons tocategory woocommmerce how to apply woocommerce coupon to all products coupon in cart woocommerce woocommerce add free shipping coupon woocommerce discount coupon for specific product in cart woocommerce discount coupon for each product in cart woocommerce add coupon programmatically custom add coupon woocommerce coupon code add on mini cart woocommerce how to add discount when add to cart for certain products woocommerce programmatically how to add discount when add to cart of certain product custom woocommerce coupon code field in woocommerce cart page how to add coupon option add in woocomeerce how to display coupon code discount price in cart page in woocommerce using code place apply coupon in woocommerce above total cart page add coupon section woocommerce after shipping woocommerce auto apply coupon woocommerce woocommerce coupon added without woocommerce add coupon automatically apply coupon link in woocommerce apply coupon in woocommerce woocommerce apply coupon to product add coupon woocommerce add discount code in cart woocommerce woocommerce show apply coupon how to style the add coupon on the cart page in woocommerce how to add coupon in woocommerce woocommerce apply coupon programmatically add coupon in woocommerce woocommerce coupons add discount to both product if there are in cart woocommerce coupons add discount to both product if their are in cart woocommerce add to cart woocomerce add coupon by url apply coupon by url i cant add my product to the cart in woocommerce woocommerce add to cart function woocommerce apply discount product price in cart coupon code url url add coupon auto applly coupon at checkout add coupon by url coupon code in link woocommerce woocommerce apply coupon redirection back to devleopment site create a woocommerce url that automatically fills in coupon code woocommerce product link with coupon code url for cart with coupon woocommerce add discount coe in cart woocommerce woocommerce apply coupon with add to cart coupon in url parameter woocommerce apply coupon with add to cart coupon
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source