Home Forums WoodMart support forum Disable buy button when productprice is zero

Disable buy button when productprice is zero

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #695675

    larsnielsengm
    Participant

    Hi Xtemos

    We have a webhook code for removing the buybutton when price is zero – And it works for standard themes !

    But when I activate woodmart-theme, the code stops working!?

    Webhook code:

    add_action(‘woocommerce_single_product_summary’, ‘replace_zero_price_button_single’, 30);
    function replace_zero_price_button_single() {
    global $product;

    $price = $product->get_price();

    if (empty($price) || $price == 0) {

    remove_action(‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30);
    remove_action(‘woocommerce_simple_add_to_cart’, ‘woocommerce_simple_add_to_cart’, 30);
    remove_action(‘woocommerce_variable_add_to_cart’, ‘woocommerce_variable_add_to_cart’, 30);
    remove_action(‘woocommerce_grouped_add_to_cart’, ‘woocommerce_grouped_add_to_cart’, 30);
    remove_action(‘woocommerce_external_add_to_cart’, ‘woocommerce_external_add_to_cart’, 30);
    }
    }

    I have made you a login

    #695784

    Artem Temos
    Keymaster

    Hello,

    Please, switch to the default theme and add the code so we can test how it works. Send us a direct link to the page where it works as you expect. Then we will switch to WoodMart and check what is different.

    Kind Regards

    #695799

    larsnielsengm
    Participant

    see below

    #695804

    Artem Temos
    Keymaster

    We have adjusted the code to make it work with our theme as well. Here is a screenshot https://monosnap.ai/file/z1WjBMIzAL0SA1hY979o30bMNBVTWR

    #695806

    larsnielsengm
    Participant

    Thank you so much – very nice !

    #695833

    Artem Temos
    Keymaster

    You are always welcome.Feel free to contact us if you have any further questions.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Disable buy button when productprice is zero’ is closed to new replies.