Hi,
I’m not sure if you’ll be able to help with this. I have dynamic pricing so I can show my Wholesale Customers (one user group) prices that are different from my Retail Customers (my second user group).
In order to allow bulk purchasing without paying for additional plugins, I created an attribute called “Wholesale Bulk Ordering” which allows my Wholesale customers to purchase the whole line of clothing, rather than add several items one by one. That said, when I did this the prices for retail customers shows a very high range on the shop page (e.g. $80-420). When my Wholesale customers login, Dynamic Pricing changes it to say “From $” and displays the lowest wholesale prices (which is appropriate). I would like to hide the high price from my retail customers so it says the price of a single item of clothing, without messing up the Dynamic Pricing plugin, which is working properly.
I added the following code to revert WooCommerce back to its other setting, but it no longer lets Dynamic Pricing show “From $(lowest wholesale price)” on the Shop page. Instead, it shows the retail price. The individual products still show the Wholesale prices though.
Code added to functions.php
// Use WC 2.0 variable price format, now include sale price strikeout
add_filter( ‘woocommerce_variable_sale_price_html’, ‘wc_wc20_variation_price_format’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’, ‘wc_wc20_variation_price_format’, 10, 2 );
function wc_wc20_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( ‘min’, true ), $product->get_variation_price( ‘max’, true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( ‘From: %1$s’, ‘woocommerce’ ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
// Sale Price
$prices = array( $product->get_variation_regular_price( ‘min’, true ), $product->get_variation_regular_price( ‘max’, true ) );
sort( $prices );
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( ‘From: %1$s’, ‘woocommerce’ ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
if ( $price !== $saleprice ) {
$price = ‘‘ . $saleprice . ‘ <ins>’ . $price . ‘</ins>’;
}
return $price;
}
Do you have any advice?
Thanks for your help.