Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save renventura/5120f3cda15eefa26e384bd901cfe8c4 to your computer and use it in GitHub Desktop.
Save renventura/5120f3cda15eefa26e384bd901cfe8c4 to your computer and use it in GitHub Desktop.
Filters the Custom Redirects for WooCommerce redirect URL (requires http://wc-redirects.com/)
<?php
add_filter( 'woocommerce_custom_redirects_redirect_url', 'wcr_filter_redirect' );
/**
* Filters the custom redirect URL.
* Requires Custom Redirects for WooCommerce.
* @link http://wc-redirects.com/
*
* @param string $redirect Redirect URL
* @param string $type Redirect type (add-to-cart or after-purchase)
* @param int $product_id ID of product
*
* @return string
*/
function wcr_filter_redirect( $redirect, $type, $product_id ) {
// Logic here
return $redirect;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment