lundi 28 novembre 2016

Different Add to Cart button links for different products in Woocommerce?

How do I customize this php snippet to have different Add to Cart button links for different products throughout the website?

The code is intended to do the following

I.E:

Product with ID: 01 uses a Buy Button that redirects to www.example/ONE Product with ID: 02 uses a Buy Button that redirects to www.example/TWO

Code I want to customize:

<?php   

function custom_add_to_cart_redirect() 
{ 
    return 'http://ift.tt/2go5hPu'; 
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );

?>

So, how would I take into account the product var ID in other to have different buy buttons links depending on the product ID?




Aucun commentaire:

Enregistrer un commentaire