Created
May 3, 2018 21:40
-
-
Save jamesckemp/199386787b5341199b656ac846d1335a to your computer and use it in GitHub Desktop.
Don't redirect add to cart form on WooCommerce archive pages. https://iconicwp.com/blog/show-variations-shop-page-woocommerce/#comment-356
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 | |
/** | |
* Don't redirect on archive pages. | |
* | |
* @param string $redirect | |
* | |
* @return string | |
*/ | |
function iconic_add_to_cart_form_action( $redirect ) { | |
if ( ! is_archive() ) { | |
return $redirect; | |
} | |
return ''; | |
} | |
add_filter( 'woocommerce_add_to_cart_form_action', 'iconic_add_to_cart_form_action' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment