"Sold Out" button/style in The Grid

I am using The Grid to display my products from Woocommerce, though if an item is sold out I wish to display something if it is sold out For example, like it shows a button for “Sale!” when it’s on sale, I’d like to have a button/style for any sold out items.

Is there a way to use The Grid’s skin builder to do this?

Hi there,

Thanks for writing in.

It’s not currently possible, I checked the skin builder and there is no option for Sold out option. I searched some workaround and there is no available as of now.

How about have two grids, first grid for sale, and second grid for sold, then you can use a different skin for each grid (the skin with a layer saying sold.

Then use WP_Query to filter the grid result for sold items, like this

function my_query_args($query_args, $grid_name) {

    if ($grid_name == 'My grid name') {
        // all query parameters can be modified (https://codex.wordpress.org/Class_Reference/WP_Query)
        $query_args['posts_per_page'] = 2;
    }
    
    return $query_args;
    
}

add_filter('tg_wp_query_args', 'my_query_args', 10, 2);

It’s from here https://theme-one.com/docs/the-grid/

And you can implement this query args https://tarei.me/2014/02/03/build-custom-wp-query-loop-getting-woocommerce-stock-products/ for out-of-stock filtering.

This is a bit complex so you may want to ask help from a developer. This is just an idea if you wish to go in that direction (2 separate grid) :slight_smile:

Thanks!