How to make Buy Now button for products instead of select option

This topic has 8 replies, 3 voices, and was last updated 2 years, 5 months ago ago by Olga Barlow

  • Avatar: Saira
    Saira
    Participant
    June 16, 2022 at 06:42

    Some products in Shop page showing ‘Select Options’ button for products instead of ‘Buy Now’. How to make all products button to Buy Now in shop page.
    https://snipboard.io/m3tlhY.jpg

    7 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 16, 2022 at 07:22
    Avatar: Saira
    Saira
    Participant
    June 27, 2022 at 13:02

    As given in this link, I have given the following code in the Snippets

    add_filter( ‘woocommerce_product_add_to_cart_text’, ‘bbloomer_change_select_options_button_text’, 9999, 2 );

    function bbloomer_change_select_options_button_text( $label, $product ) {
    if ( $product->is_type( ‘variable’ ) ) {
    return ‘View Product’;
    }
    return $label;
    }

    But there is no change for the select option button of variable products in the shop page, now also it is displaying as select option button

    screenshot : https://snipboard.io/XCEeK0.jpg

    Thank You

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 27, 2022 at 13:19

    Hello,

    Please provide access, so we can take a closer look.

    Regards

    Avatar: Saira
    Saira
    Participant
    June 28, 2022 at 05:49

    I Will provide the details
    Snippets name is – select option to buy now button

    Thank You

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 28, 2022 at 12:16

    Hello,

    The filter that we recommended for you before had some issues in your code https://prnt.sc/zZIzULBe8Kdp . Once we fixed it and wrote correctly it became to work for products but not for the one on first page ( https://prnt.sc/X4X16X-M9IxV )
    The reason for such products was in plugin ‘
    WooCommerce Product Add-Ons Ultimate’ that allows to create groups here ( https://prnt.sc/79qG7ScNrEHI ) and that product has such group which is the reason of no-working filter for button text. So after we disabled the plugin text started to work normally -> https://prnt.sc/JddYyJ8S4bBf that means you should contact to plugin’s author and find out why that filter does not work if their plugin is enabled.

    Regards

    Avatar: Saira
    Saira
    Participant
    June 28, 2022 at 13:44

    Thank you for your response, I will talk with plugin team

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 28, 2022 at 13:44

    Hello,

    You are welcome.

    Regards

  • Viewing 8 results - 1 through 8 (of 8 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.