Widgets and Shortcodes
There may be times where were you want to display product information on a regular page instead of using the built-in permalink structure. There are several shortcodes to aid in this process.
If you would like to use Shortcodes inside of a page or post, you can do so by passing in the product’s slug.
Full Product Details
Product Category Page
Display All Products
Here’s some code to display your all-products page in a shortcode. Save that file as foxyshop-all-products-shortcode.php in your theme folder, then add this code into your functions.php file.
Finally, you’ll place this in the desired location on the page:
Add To Cart Link (URL Only)
Add To Cart Link (Formatted Link)
[product name="product-slug"]Add To Cart[/product]
[product name="product-slug" variations="Color=Green&Size=Large"]Add To Cart[/product]
The theme customization files for the product details and the category page can be found in the /themefiles/ directory. Read more about editing theme files. These shortcodes don’t, by default, do everything that a regular product page does since there isn’t a permanent url attached. For this reason, it’s recommended that you use the permalink structure if you can.
FoxyShop has some pre-loaded widgets available on the Appearances / Widgets menu:
- Add a Shopping Cart link that automatically updates with the quantity and price
- Display products in a featured category
- Display a list of categories
If you’d like a widget to show only a specific product, here’s some code to do that. Just put this code in your functions.php file.