bigcommerce-for-wordpress icon indicating copy to clipboard operation
bigcommerce-for-wordpress copied to clipboard

Products Shortcode does not allow displaying a single result in the grid template

Open corgalore opened this issue 2 years ago • 0 comments

Expected behavior

Use the Products Shortcode to display a grid of products in a category, rendered using card template, even if there's only one result.

Actual behavior

If only one product is returned in query of Products Shortcode, the result is rendered using the Product_Shortcode_Single template, instead of Product_Shortcode_Grid.

Steps to reproduce behavior

  1. Create a BigCommerce category and add only one product to it. Sync into Wordpress.
  2. Use this shortcode on a page with your category slug: [bigcommerce_product category=my-category order=DESC orderby=date paged=1 per_page=9]

Line causing issue

https://github.com/bigcommerce/bigcommerce-for-wordpress/blob/master/src/BigCommerce/Shortcodes/Products.php#L71

corgalore avatar Apr 11 '23 16:04 corgalore