"Add to Cart" Button Redirect to a Custom Link

This topic has 2 replies, 2 voices, and was last updated 6 years, 7 months ago ago by Rose Tyler

  • Avatar: jvusena
    jvusena
    Participant
    September 15, 2017 at 16:25

    Hello Everyone, I’m using Woopress WP Theme, I would like to customize my “Add to Cart” buttons so that when the user clicks, they shall be redirected to a Custom Page like http://www.domain.com/request_quote

    I would like to change the “Add to Cart” text to “Request Quote”
    I also want to disable products from being added to the Cart, I have done this before with a different theme using this code:
    /**
    * Redirect users after add to cart.
    */
    function my_custom_add_to_cart_redirect( $url ) {

    $url = get_permalink( 3378 ); // URL to redirect to (3378 is the page ID here)

    return $url;

    }
    add_filter( ‘woocommerce_add_to_cart_redirect’, ‘my_custom_add_to_cart_redirect’ );
    /**
    * Making Products not purchasable.
    */
    add_filter( ‘woocommerce_is_purchasable’,’__return_false’,10,2);

    Kindly assist me to implement this function using Woopress Theme.

    Regards.

    1 Answer
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 18, 2017 at 10:00

    Hello,

    Such questions request additional customization which is beyond our basic support scope. You can contact WPKraken team to get help with additional development.
    You may try this way to make redirect: Woocommerce -> settings -> products -> display http://prntscr.com/gmi46n and add this code in functions.php of your child theme:

    function et_added_to_cart_redirect() { 
     return $url = "request_quote"; // for example
    }; 
    add_filter('woocommerce_add_to_cart_redirect', 'et_added_to_cart_redirect'); 

    Please read this article https://docs.woocommerce.com/document/change-add-to-cart-button-text/
    Also, you may activate Just Catalog options in Theme Options > Shop.

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.