Untitled
unknown
plain_text
a month ago
1.1 kB
4
Indexable
Never
// Function to replace price with 'Quote' function replace_price_with_quote($price, $product) { if (function_exists('b2bking') && b2bking()->user_has_p_in_cart('quote') === 'yes') { return 'Quote'; } return $price; } // Apply price replacement to various WooCommerce hooks add_filter('woocommerce_get_price_html', 'replace_price_with_quote', 10, 2); add_filter('woocommerce_cart_item_price', 'replace_price_with_quote', 10, 2); add_filter('woocommerce_cart_item_subtotal', 'replace_price_with_quote', 10, 2); add_filter('woocommerce_order_formatted_line_subtotal', 'replace_price_with_quote', 10, 2); // Function to replace 'Add to cart' text function replace_add_to_cart_text($text, $product) { if (function_exists('b2bking') && b2bking()->user_has_p_in_cart('quote') === 'yes') { return 'Add to quote request'; } return $text; } // Apply 'Add to cart' text replacement add_filter('woocommerce_product_single_add_to_cart_text', 'replace_add_to_cart_text', 10, 2); add_filter('woocommerce_product_add_to_cart_text', 'replace_add_to_cart_text', 10, 2);
Leave a Comment