If you wish to show the flat fee amount below the unit price and only for simple products here is the code:
function change_simple_product_price_display( $price_html, $product ) {
if ( is_product() ) {
if ( $product->is_type( 'simple' ) ) {
$flat_fee = get_post_meta( $product->get_id(), 'product-fee-amount', true );
if ( ! empty( $flat_fee ) ) {
$price_html = $price_html . '<br>' . __('+ One Time Charges (excl. VAT):', 'Your Domain') . ' ' . wc_price($flat_fee);
}
}
}
return $price_html;
}
add_filter( 'woocommerce_get_price_html', 'change_simple_product_price_display', 10, 2 );
If you wish to show the flat fee for all your products, then you need to remove the if ( $product->is_type( ‘simple’ ) ) part of the code.
-
This reply was modified 6 years, 8 months ago by
ittspiritgr.
-
This reply was modified 6 years, 8 months ago by
ittspiritgr.