• Resolved Snehal Volvoikar

    (@snehalvolvoikar29)


    Hello! I have variable products in my store. When clicking on certain variations/attrributes, it should link to “Get Quote” page on my website. Is it possible? Please note that for other product options, it should display ‘Add to cart’ button and only for one variation of the product it should change it to a link or a buttton with a link to the “Get Quote” page.

    There is one variation for which we can’t decide the final price so we want that customers should have no other option other thn submitting a quote request through our form. Please help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Snehal Volvoikar

    (@snehalvolvoikar29)

    I have used this code to add “REQUEST CODE” button but the “add to cart” button should disappear after showing “request quote” button.

    add_filter('woocommerce_get_price_html', 'requestQuote', 10, 2);
    
    function requestQuote($price, $product) {
    	        $button_text = __( "Get Quote", "woocommerce" );
    	 $button_link = 'https://afmanagement.ae/get-quote/';
            if ( $price == wc_price( 715.00 ) ){
    
                     remove_action( 'woocommerce_variable_product_summary', 
          'woocommerce_template_variable_add_to_cart', 30 );
            return '<a href="'.$button_link.'">' . $button_text . '</a>';        }
    
            else{
                return $price;}
    }

    The remove_action( ‘woocommerce_variable_product_summary’,
    ‘woocommerce_template_variable_add_to_cart’, 30 );
    action doesnt remove add to cart button.
    am i using the right action?

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers.

    Thread Starter Snehal Volvoikar

    (@snehalvolvoikar29)

    Hi…I’ve set the variation to “out of stock” and when a product becomes out of stock, the “add to cart” button is hidden using a function. And I’ve replaced the variation price text with “Request quote” button and since add to cart button is hidden, they can’t do add to cart, so they will have to click on request quote button which will take them to the “Get quote” page and they can submit the form. The function is working as expected. I’m closing this ticket.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Replace add to cart with a link’ is closed to new replies.