Created
December 3, 2012 12:42
-
-
Save jdevalk/4194802 to your computer and use it in GitHub Desktop.
Add to cart by GET request
This file contains hidden or 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 | |
| /** | |
| * Convenience function to allow linking to a checkout page and adding the product to the cart in one swoop. | |
| */ | |
| function edd_add_to_cart_by_get( ) { | |
| if ( edd_is_checkout() ) { | |
| if ( isset( $_GET['edd_add_to_cart'] ) ) { | |
| edd_add_to_cart( intval( $_GET['edd_add_to_cart'] ) ); | |
| } | |
| } | |
| } | |
| add_action( 'get_header', 'edd_add_to_cart_by_get' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment