Skip to content

Snippet: Use a Theme Card for WooCommerce Product Entries

You can now define your WooCommerce card style via the Customizer!

This snippet allows you to define a card style for your WooCommerce products. Previously you couldn't assign this via the Customizer so you had to use code. Now you can define your global product card style via the Customizer, but you can still use the filter if you wish to define a different card style for different parts of the site. For example you could use different card styles based on the product type (external, variation, etc), for different categories, based on the WooCommerce context, etc.

/**
 * Filter the WooCommerce post card style.
 *
 * @link https://total.wpexplorer.com/docs/snippets/use-a-theme-card-for-woocommerce-product-entries/
 */
add_filter( 'woo_entry_card_style', function( $style ) {
    $style = 'blog_1'; // change this to the card style ID you wish to use.
    return $style;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top