{"id":4681,"date":"2020-06-15T11:20:41","date_gmt":"2020-06-15T18:20:41","guid":{"rendered":"https:\/\/codedcommerce.com\/?post_type=product&#038;p=4681"},"modified":"2024-04-10T20:46:17","modified_gmt":"2024-04-11T03:46:17","slug":"quote-request-logic","status":"publish","type":"woo-code","link":"https:\/\/codedcommerce.com\/woo\/quote-request-logic\/","title":{"rendered":"Quote Request logic"},"content":{"rendered":"\n<pre class=\"wp-block-code language-php\"><code>\/\/ Force Everything Purchasable\nadd_filter( 'woocommerce_is_purchasable', '__return_true' );\n\n\/\/ Force Variations Enablement\nadd_filter( 'woocommerce_hide_invisible_variations', '__return_false' );\n\nadd_filter( 'woocommerce_variation_is_visible', function( $is_visible ) {\n\n\treturn true;\n\n} );\n\n\/\/ Simple Products - Force No Price Products Zero - Prevents PHP 8.0 Crash\nadd_filter( 'woocommerce_product_get_price', function( $price ) {\n\n\treturn $price ? $price : 0.00;\n\n} );\n\n\/\/ Variation Products - Force No Price Products Zero - Prevents PHP 8.0 Crash\nadd_filter( 'woocommerce_product_variation_get_price', function( $price ) {\n\n\treturn $price ? $price : 0.00;\n\n} );\n\n\/\/ Display: Empty Product Price\nadd_filter(\n\t'woocommerce_empty_price_html',\n\tfunction() { return 'RFQ'; }\n);\nadd_filter(\n\t'woocommerce_variable_empty_price_html',\n\tfunction() { return 'RFQ'; }\n);\nadd_filter(\n\t'woocommerce_variation_empty_price_html',\n\tfunction() { return 'RFQ'; }\n);\n\n\/\/ Display: Single Product Variation Price Range\nadd_filter( 'woocommerce_variable_price_html', function( $price_html, $product ) {\n \n    $price_numeric = floatval( $product->get_price() );\n \n    return $price_numeric > 0 ? $price_html : 'RFQ';\n \n}, 10, 2 );\n\n\/\/ Display: Single Product Price\nadd_filter( 'woocommerce_get_price_html', function( $price_html, $product ) {\n \n    $price_numeric = floatval( $product->get_price() );\n \n    return $price_numeric > 0 ? $price_html : 'RFQ';\n \n}, 10, 2 );\n\n\/\/ Display: Order Item Table Price\nadd_filter( 'woocommerce_cart_item_price', function( $price, $cart_item ) {\n\n\t$price_numeric = floatval( $cart_item&#91;'line_subtotal'] );\n\n\treturn $price_numeric > 0 ? $price : 'RFQ';\n\n}, 10, 2 );\n\n\/\/ Display: Order Item Table Subtotal\nadd_filter( 'woocommerce_cart_item_subtotal', function( $price, $cart_item ) {\n\n\t$price_numeric = floatval( $cart_item&#91;'line_subtotal'] );\n\n\treturn $price_numeric > 0 ? $price : 'RFQ';\n\n}, 10, 2 );\n\n\/\/ Display: Cart Subtotal\nadd_filter( 'woocommerce_cart_subtotal', function( $subtotal ) {\n\n\treturn $subtotal == wc_price( '0.00' )\n\t\t? 'RFQ' : $subtotal;\n\n} );\n\n\/\/ Emails: Order Item Table Subtotal\nadd_filter( 'woocommerce_order_formatted_line_subtotal',\n\tfunction( $subtotal ) {\n\n\treturn $subtotal == wc_price( '0.00' )\n\t\t? 'RFQ' : $subtotal;\n\n} );\n\n\/\/ Emails: Cart Subtotal\nadd_filter( 'woocommerce_order_subtotal_to_display', function( $subtotal ) {\n\n\treturn $subtotal == wc_price( '0.00' )\n\t\t? 'RFQ' : $subtotal;\n\n} );<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-4681","woo-code","type-woo-code","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/codedcommerce.com\/wp-json\/wp\/v2\/woo-code\/4681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codedcommerce.com\/wp-json\/wp\/v2\/woo-code"}],"about":[{"href":"https:\/\/codedcommerce.com\/wp-json\/wp\/v2\/types\/woo-code"}],"wp:attachment":[{"href":"https:\/\/codedcommerce.com\/wp-json\/wp\/v2\/media?parent=4681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}