Untitled
plain_text
a month ago
1.7 kB
1
Indexable
Never
add_filter( 'woocommerce_cart_item_price', 'kd_custom_price_message', 99999 ); add_filter( 'woocommerce_cart_item_subtotal', 'kd_custom_price_message', 99999 ); add_filter( 'woocommerce_cart_subtotal', 'kd_custom_price_message', 99999 ); add_filter( 'woocommerce_cart_total', 'kd_custom_price_message', 99999 ); add_filter( 'woocommerce_cart_shipping_method_full_label', 'kd_custom_price_message', 99999 ); add_action('b2bking_offer_frontend_after_unit_price', 'show_suffix'); add_action('b2bking_offer_frontend_after_subtotal', 'show_suffix'); add_action('b2bking_offer_frontend_after_total', 'show_suffix'); add_action('b2bking_list_frontend_after_subtotal', 'show_suffix'); add_action('b2bking_frontend_after_accounting_subtotals', 'show_suffix'); function show_suffix(){ echo kd_custom_price_message(''); } function kd_custom_price_message( $price ) { $vat_exempt = false; global $woocommerce; $customertest = $woocommerce->customer; if (is_a($customertest, 'WC_Customer')){ $vat_exempt = WC()->customer->is_vat_exempt(); } if ($vat_exempt){ $suffix = '<small class="woocommerce-price-suffix"> '.apply_filters('b2bking_price_suffix_ex_vat', esc_html__('ex. VAT', 'b2bking')).'</small>'; } else { if (get_option('woocommerce_tax_display_shop') === 'excl'){ $suffix = '<small class="woocommerce-price-suffix"> '.apply_filters('b2bking_price_suffix_ex_vat', esc_html__('ex. VAT', 'b2bking')).'</small>'; } else { $suffix = '<small class="woocommerce-price-suffix"> '.apply_filters('b2bking_price_suffix_inc_vat', esc_html__('inc. VAT', 'b2bking')).'</small>'; } } return $price.' '.$suffix; }