• Resolved Website delivery

    (@arvanderkamp)


    Hi,

    I want to show the minimum price on the product overview page (in the WooCommerce loop). How can I achieve this? It should be something like this:

    global $product;
    $min_price = get_product_meta(‘minimum_price_field’);

    <?php if( $min_price ): ?>
    <span class=”price”>From <?php echo $min_price; ?></span>
    <?php endif; ?>

    Thanks in advance!

    Regards,
    Alex

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    You can do it like this:

    // Display min price on WooCommerce loop using the Open Pricing plugin
    add_action('woocommerce_after_shop_loop_item_title',function(){
    	global $product;
    	$product_id = $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id();			
    	if(
    		! class_exists( 'Alg_WC_Product_Open_Pricing' ) ||
    		'yes' !== get_post_meta( $product_id, '_' . 'alg_wc_product_open_pricing_enabled', true )
    	){
    		return;
    	}
    	$min_price = get_post_meta( $product_id, '_' . 'alg_wc_product_open_pricing_min_price', true );	
    	$min_price = apply_filters( 'aopwc_frontend_input_value', $min_price, 'min' );
    	?>
    	<?php if ( !empty( $min_price ) ) : ?>
    		<div class="min-price">
    			<span>Min Price: </span>
    			<span class="min-price-value"><?php echo wc_price($min_price); ?></span>
    		</div>
    	<?php endif; ?>
    	<?php
    });

    Please tell me if it worked.
    See you

    Thread Starter Website delivery

    (@arvanderkamp)

    Works like a charm, thanks!

    Great!
    In that case, would mind writing a tiny review for the plugin? It’s really important for us

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Minimum price on product overview page’ is closed to new replies.