Support » Plugin: WooCommerce » Add to cart URL

  • add to cart button custom url is not working. am using 4.6.1 version.
    function custom_add_to_cart_redirect() {
    return ‘’;
    add_filter( ‘woocommerce_add_to_cart_redirect’, ‘custom_add_to_cart_redirect’ );\

    this is not working

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi

    What version of WooCommerce are you using and can you please list out all the active plugins that you have?

    am using WC Version 2.6.7
    using plugins
    Contact Form 7
    Custom Post Type UI
    Easy Accordion Free
    LayerSlider WP
    Page Builder by SiteOrigin
    SiteOrigin Widgets Bundle
    Tabs Responsive
    Testimonial Rotator
    WooCommerce 2.6.7
    Wordfence Security
    YIKES Custom Product Tabs for WooCommerce
    YITH WooCommerce Zoom Magnifier

    link :

    @gobi004 try escaping the url you are adding using esc_url

    For example:

    function se_add_to_cart_redirect() {
    	return esc_url( '' );
    add_filter( 'woocommerce_add_to_cart_redirect', 'se_add_to_cart_redirect' );
    Plugin Support RK


    You have an extra slash at the end of this line:

    add_filter( ‘woocommerce_add_to_cart_redirect’, ‘custom_add_to_cart_redirect’ );\

    am not getting redirecting now its not purchasable, even if i give the price for the product its not getting redirection.

    i’ve added this that you (Maruti Mohanty) mentioned

    function se_add_to_cart_redirect() {
    return esc_url( ‘’ );
    add_filter( ‘woocommerce_add_to_cart_redirect’, ‘se_add_to_cart_redirect’ );

    i’ve given link manually in simple.php file directly.

    @gobi004 I am not sure what do you mean by simple.php file. You are adding the code in the wrong place. Try adding in the active theme’s functions.php file

    i’ve added that function in funcions.php only, but its nowt working. i said, i given the link manually in woocommerce/templates/single-product/add-to-cart/simple.php file by replacing of default add to cart button

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add to cart URL’ is closed to new replies.