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

Disable buy button when productprice is zero

Viewing 1 post (of 1 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

Viewing 1 post (of 1 total)