Comments 1David started the conversation2 days ago on Wednesday at 6:02pmHi, is there any way or code snippet I can use to display the lowest price configured for that product on the shop page (on each product card) using the WPC Price by Quantity plugin? 1,618Dustin replied1 day ago on Thursday at 7:56amHi David, Please add the custom code below. (How to add custom code? ↗): add_filter( 'woocommerce_get_price_html', function ( $price_html, $product ) { if ( ! class_exists( 'Wpcpq_Helper' ) ) { return $price_html; } if ( is_a( $product, 'WC_Product' ) ) { $product_id = $product->get_id(); } else { $product_id = absint( $product ); $product = wc_get_product( $product_id ); } if ( Wpcpq_Helper()::is_enable( $product_id ) ) { $pricing = Wpcpq_Helper()::get_pricing( $product_id ); if ( ! empty( $pricing['tiers'] ) && is_array( $pricing['tiers'] ) ) { if ( $price = $product->get_price() ) { $last_tier = end( $pricing['tiers'] ); $last_price = Wpcpq_Helper()::get_price( $pricing['method'], $pricing['tiers'], $last_tier['quantity'], $price ); return 'From: ' . wc_price( $last_price ); } } } return $price_html; }, 999, 2 );Best regards,Dustin Sign in to reply ...
Hi, is there any way or code snippet I can use to display the lowest price configured for that product on the shop page (on each product card) using the WPC Price by Quantity plugin?
Hi David,
Please add the custom code below. (How to add custom code? ↗):
add_filter( 'woocommerce_get_price_html', function ( $price_html, $product ) { if ( ! class_exists( 'Wpcpq_Helper' ) ) { return $price_html; } if ( is_a( $product, 'WC_Product' ) ) { $product_id = $product->get_id(); } else { $product_id = absint( $product ); $product = wc_get_product( $product_id ); } if ( Wpcpq_Helper()::is_enable( $product_id ) ) { $pricing = Wpcpq_Helper()::get_pricing( $product_id ); if ( ! empty( $pricing['tiers'] ) && is_array( $pricing['tiers'] ) ) { if ( $price = $product->get_price() ) { $last_tier = end( $pricing['tiers'] ); $last_price = Wpcpq_Helper()::get_price( $pricing['method'], $pricing['tiers'], $last_tier['quantity'], $price ); return 'From: ' . wc_price( $last_price ); } } } return $price_html; }, 999, 2 );Best regards,
Dustin