AI Verified

Name

Automatically add coupon codes to shopping cart for offers

About

The more user-friendly your store is, the more orders you will get. So why should your customers have to manually enter a coupon code you offer? It is much better to add the code automatically when the promoted product is added to the shopping cart. This will delight your customers!

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

jbeer

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

18/05/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Automatically add coupon codes to shopping cart for offers

 
                    
1if (!function_exists( 'evolution_apply_matched_coupons' ) ) :
2/**
3 * Gutscheincode automatisch bei Angebotsaktionen in den Warenkorb legen
4 */
5function evolution_apply_matched_coupons() {
6 
7 global $woocommerce;
8 //Gutscheinname eingeben
9 $coupon_code = 'hier_der_name_des_gutscheins';
10 
11 if ( $woocommerce->cart->has_discount( $coupon_code ) ) return;
12 $woocommerce->cart->add_discount( $coupon_code );
13 
14}
15add_action( 'woocommerce_before_cart', 'evolution_apply_matched_coupons' );
16endif;

0

Featured Snippet

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

WooCommerce Show Categories On Product Loop

Added: 1 year ago

Last Updated: 1 year ago

Being able to show which categories a product belongs to on the archive page make it clear to users that a product may belong to more than one category and also that there are more categories to navig...

WooCommerce

AI Verified

0

Remove "Has Been Added to Your Cart" WooCommerce Message

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

1

WooCommerce Automatically Set the Complete Order Status

Added: 1 year ago

Last Updated: 6 months ago

If you’d like to bypass the on-hold order status which either WooCommerce or the payment gateway the customer uses automatically sets on orders, and make it the Completed order status instead, then th...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

2

Confirm Password Field in Woocommerce

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

2

Bypass logout confirmation.

Added: 1 year ago

Last Updated: 1 month ago

WooCommerce

AI Verified

2

Add Product Picture to Orderlist

Added: 1 year ago

Last Updated: 1 year ago