Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #631024

    Hi,
    On this site (http://cookerycuisine.com/menu/), I’m wondering if there’s a way to display the “Sold Out” text in the product list? We’re doing a custom display of products, and we’re needing inventory control, which I have, but the “Out of Stock” doesn’t display until the person clicks on the item to order it. We need to display that so they know it’s out before trying to order it – and hopefully without having to log in and type it in manually. My client is going to be super busy managing the kitchen.

    I don’t suppose there’s a way to display the WooCommerce reviews on this page, either, is there? Besides premium plugins? I’m trying to save my client as much $$$ as possible. :)

    Thanks!

    #631991

    Hey Taryn,

    Thank you for using Enfold.

    Please add this in the functions.php file:

    add_filter('woocommerce_loop_add_to_cart_link', 'woocommerce_loop_add_to_cart_link_mod', 10, 2);
    function woocommerce_loop_add_to_cart_link_mod($product, $id) {
    	if( $id->stock_status == 'outofstock' ) {
    		$stock = $id->stock_status == 'outofstock' ? 'outofstock' : '';
    		$replace = 'class="' . $stock . ' ';
    		$product = str_replace('class="', $replace, $product);
    	}
    
    	return $product;
    }
    

    And this code in the Quick CSS field:

    .outofstock.av-catalogue-item:before {
        content: 'Out of Stock';
    }

    Style it as you want.

    Best regards,
    Ismael

    #646406

    Sorry it took me so long to respond – been out for bit. Thank you very much for your help! :)

    #647160

    Hi,

    No problem, glad we could help :-)

    Regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.