Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created April 30, 2020 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xlplugins/40ae2c1fb9db501e2fac855a5c174765 to your computer and use it in GitHub Desktop.
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
<?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