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 ‘http://www.yourdomain.com/your-page/’;
    }
    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 : http://cmsonlive.com/sawyer

    @gobi004 try escaping the url you are adding using esc_url

    For example:

    function se_add_to_cart_redirect() {
    	return esc_url( 'http://sourcexpress.com/' );
    }
    add_filter( 'woocommerce_add_to_cart_redirect', 'se_add_to_cart_redirect' );
    Plugin Support RK

    (@riaanknoetze)

    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( ‘http://www.amazon.in/gp/aag/main/ref=olp_merch_name_1?ie=UTF8&asin=B00B1OSU4W&isAmazonFulfilled=0&seller=A2YE2J5SRQXWSP’ );
    }
    add_filter( ‘woocommerce_add_to_cart_redirect’, ‘se_add_to_cart_redirect’ );

    http://cmsonlive.com/sawyer/products/bucket-faucet-water-filter-sp283/

    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.