Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // WooCommerce - Complex price suffixes
- add_filter('woocommerce_get_price_suffix', 'custom_get_price_suffix', 90, 4 );
- function custom_get_price_suffix( $html, $product, $price, $qty ) {
- if ( ! $html && $product instanceof WC_Product_Variable ) {
- // copied from woocommerce/includes/abstracts/abstract-wc-product.php#get_price_suffix
- if ( ( $suffix = get_option( 'woocommerce_price_display_suffix' ) ) && wc_tax_enabled() && 'taxable' === $product->get_tax_status() ) {
- $replacements = array(
- '{price_including_tax}' => wc_price( wc_get_price_including_tax( $product, array( 'qty' => $qty, 'price' => $price ) ) ),
- '{price_excluding_tax}' => wc_price( wc_get_price_excluding_tax( $product, array( 'qty' => $qty, 'price' => $price ) ) ),
- );
- $html = str_replace( array_keys( $replacements ), array_values( $replacements ), ' <small class="woocommerce-price-suffix">' . wp_kses_post( $suffix ) . '</small>' );
- }
- }
- return $html;
- } // end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement