• mickif

    (@mickif)


    Hi I love this plugin, thank you for it, have been using it successfully for a few years now. Am wondering… in catalog view it shows the piece as sold when being held for an hour in someone’s cart. Is there a way to not show sold? Thank you again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author James Golovich

    (@jamesgol)

    What theme are you using? Usually the theme is adding text that says “Sold”. Sometimes it requires custom code to override.

    Thread Starter mickif

    (@mickif)

    Hey James, thank you for your quick response! Genesis/child theme. here is an example of the sold (those these are actually sold): https://maryspears.com/product-category/collage/tropical-collage/

    I just updated woo, and to be perfectly honest, this site is rather old and I did quite a bit of customization in the beginning and often cannot remember exactly what :)…

    Just found this in functions, tho the sale tag was not added to the piece prior to this update… wondering if it now causing an issue… I am somewhat php challenged…

    /**
    * @snippet Display “Sold Out” on Loop Pages – WooCommerce
    */

    add_action( ‘woocommerce_before_shop_loop_item_title’, ‘bbloomer_display_sold_out_loop_woocommerce’ );

    function bbloomer_display_sold_out_loop_woocommerce() {
    global $product;

    if ( !$product->is_in_stock() ) {
    echo ‘<span class=”soldout”>’ . __( ‘SOLD’, ‘woocommerce’ ) . ‘</span>’;
    }
    }

    Thank you again!

    Plugin Author James Golovich

    (@jamesgol)

    It does appear like that snippet of code is responsible for adding the text. You could try changing it to something like this and it would only shows SOLD if the actual stock is less than 1.

    function bbloomer_display_sold_out_loop_woocommerce() {
    global $product;
    
    $csr = WC()->integrations->get_integration('woocommerce-cart-stock-reducer');
    $actual_stock = $csr->get_actual_stock_available( $product );
    
    if ( $actual_stock < 1 ) {
    echo ‘<span class=”soldout”>’ . __( ‘SOLD’, ‘woocommerce’ ) . ‘</span>’;
    }
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SOLD added to piece in catalog view’ is closed to new replies.