Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
2.9 kB
6
Indexable
Never
add_action('wp_loaded', 'remove_b2bking_functions');
add_action('plugins_loaded', 'remove_b2bking_functions');
add_action('wp', 'remove_b2bking_functions');
function remove_b2bking_functions(){

    global $b2bking_public;
    remove_filter( 'woocommerce_is_purchasable', array($b2bking_public, 'b2bking_prevent_cart_product_purchasable'), 10, 2);
    remove_filter( 'woocommerce_variation_is_purchasable', array($b2bking_public, 'b2bking_prevent_cart_product_purchasable'), 10, 2);
    remove_action( 'b2bking_product_page_error_message', array($b2bking_public, 'unavailable_product_display_message_products'), 20 );

    remove_filter( 'woocommerce_is_purchasable', array($b2bking_public, 'b2bking_prevent_quote_product_purchasable'), 10, 2);

    remove_filter( 'woocommerce_variation_is_purchasable', array($b2bking_public, 'b2bking_prevent_quote_product_purchasable'), 10, 2);

    remove_action( 'b2bking_product_page_error_message', array($b2bking_public, 'unavailable_product_display_message_products_quote'), 20 );

    remove_filter('woocommerce_product_single_add_to_cart_text', array($b2bking_public,'b2bking_replace_add_to_cart_text_products'), 10, 2);
    remove_filter('woocommerce_product_add_to_cart_text', array($b2bking_public,'b2bking_replace_add_to_cart_text_products'), 10, 2);

    // Replace add to cart with quote on these products
    remove_filter('woocommerce_product_single_add_to_cart_text', array('B2bking_Public','b2bking_replace_add_to_cart_text_products'), 10, 2);
    remove_filter('woocommerce_product_add_to_cart_text', array('B2bking_Public','b2bking_replace_add_to_cart_text_products'), 10, 2);

    // prevent regular cart products from being purchased
    remove_filter( 'woocommerce_is_purchasable', array('B2bking_Public', 'b2bking_prevent_cart_product_purchasable'), 10, 2);
    remove_filter( 'woocommerce_variation_is_purchasable', array('B2bking_Public', 'b2bking_prevent_cart_product_purchasable'), 10, 2);

    // show message in cart that other products can't be added to quote while you have an offer in cart
    remove_action( 'woocommerce_before_cart', array('B2bking_Public','b2bking_cannot_quote_offer_cart_message_products'), 100);

    // show message on single product page 
    remove_action( 'woocommerce_single_product_summary', array('B2bking_Public', 'unavailable_product_display_message_products'), 20 );
    // cannot add quote products to cart
    remove_filter( 'woocommerce_is_purchasable', array('B2bking_Public', 'b2bking_prevent_quote_product_purchasable'), 10, 2);
    remove_filter( 'woocommerce_variation_is_purchasable', array('B2bking_Public', 'b2bking_prevent_quote_product_purchasable'), 10, 2);

    // show message on single product page 
    remove_action( 'woocommerce_single_product_summary', array('B2bking_Public', 'unavailable_product_display_message_products_quote'), 20 );

}
Leave a Comment