Last active
July 22, 2020 08:48
-
-
Save sarangs07/21c4efc3ccb1b42ebee5801008a09e13 to your computer and use it in GitHub Desktop.
Change the add-to-cat button URL
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
/* | |
* How to add the custome code. | |
* | |
* Please follow below instructions: | |
* 1. Copy the below code. | |
* 2. Open your child theme's functions.php file. | |
* 3. Paste the copied code at the very bottom of it & save the file OR upload it on your server/hosting. | |
*/ | |
/* Change the add-to-cat button URL */ | |
add_filter( 'woocommerce_add_to_cart_form_action', 'pp_change_butn_url' ); | |
function pp_change_butn_url( $url ){ | |
global $post; | |
if( your_product_id === $post->ID ){ | |
$url = "add_your_landing_page_url"; | |
} | |
return $url; | |
} | |
/* Change the add-to-cat button URL */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment