Created
April 30, 2020 07:10
-
-
Save xlplugins/40ae2c1fb9db501e2fac855a5c174765 to your computer and use it in GitHub Desktop.
Apply coupon using url parameter 'apply_coupon' in aerocheckout Example http://oneclickupsell.com/checkouts/amazon/?apply_coupon=wcc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wfacp_after_add_to_cart', function () { | |
if ( isset( $_GET['apply_coupon'] ) && '' !== $_GET['apply_coupon'] ) { | |
$coupon = trim( $_GET['apply_coupon'] ); | |
WC()->cart->apply_coupon( $coupon ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment