Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #205422

    Hi,
    I would like to indicate an object sold by an icon. can you tell me where to add a line of code to indicate that the item is sold, I sell one copy… I already change “Promotion !” for “sold!” :
    But I would have 2 options.
    thank you in advance
    regards

    #205489

    Hi clo47!

    You need to the specify the availability of the product as “Out of Stock”. Add this at the very bottom of functions.php:

    
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    add_action( 'woocommerce_after_shop_loop_item_title', 'custom_template_loop_price', 10);
     
    function custom_template_loop_price() {
    	global $product;
    	if ( !$product->is_in_stock() ) {
    		echo '<span class="out-of-stock">' . __( 'Sold Out','woocommerce' ) . '</span>';
    	} else {
    		woocommerce_get_template( 'loop/price.php' );
    	}
    }

    You can use the “out-of-stock” css selector class to style the “Sold Out” text.

    Best regards,
    Ismael

    #205949

    thank you Ismael (beautiful name) I’ll try that!

    #205953

    We looking forward to hearing from you :)

    Regards,

    Josue

    #208398

    Hi,
    where to add these lines of code, thank you, I’m not an expert … sorry in Function.php of Abundance’s theme or WooCommerce?
    please help
    regards

    #208428

    functions.php

    Regards,
    Josue

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.