trade-prices.php
// Hide trade prices from guests
add_filter( 'woocommerce_get_price_html',
function ( $price, $product ) {
$trade = has_term( 'wholesale', 'product_cat',
$product->get_id() );
if ( $trade && ! is_user_logged_in() ) {
return esc_html__( 'Log in for trade price', 'store' );
}
return $price;
}, 10, 2 );
How we codeCode the next developer can read
We extend WordPress and WooCommerce through hooks and APIs instead of editing core files or copying templates, and we document what we build. If you ever change developers, the code still makes sense.
- WordPress and WooCommerce coding standards
- Escaped output, nonces and capability checks
- Handover notes with every project