Snippets

Code snippets are often a good way to add minor functionality without the need for extra plugins. The code should be added to either the functions.php file in a child theme, or into a utility plugin that you have created specifically for that purpose.

The code samples below are suitable for Classic Commerce or WooCommerce and are divided into five categories:

  • Add or apply snippets add extra functionality.
  • Modify snippets change the way some existing processes work.
  • Remove or hide snippets take away some existing functionality.
  • Redirect snippets send users off to a different destination.
  • Email snippets modify or extend the emails sent out.

ADD OR APPLY (22)

…to category pages

Add short description to category page
Show product dimensions on category page
Show product weight on category pages
Add quantity selector to the category page
Display “Out of stock” on category pages
Add “New” badge for recently added items

…to the checkout process

Set a minimum order quantity for checkout
Set a minimum order amount for checkout
Set an order quantity multiple for checkout
Apply a coupon discount for minimum cart total
Apply weight-based shipping options to checkout
Display total weight on cart and checkout pages
Add custom message at payment button
Set discount for bulk buying
Display extra amount needed for free shipping
Include a ClassicPress page on order received page
Ask for donation in checkout process

…on the site

Add country prefix before $ in prices
Add a custom message to the login page
Show default short description if empty
Add prefix to prices
Add suffix to prices


REMOVE OR HIDE (23)

…on the single product page

Remove meta info from the products page
Remove related products section
Remove additional information tab
Remove tags meta box from product data page
Remove “description” heading under single product tab
Disable zoom feature on product page images

…on category pages

Remove dropdown ordering box on category page
Remove result count from category page
Hide product count on category display pages
Remove links to individual products on category page
Hide “read more” buttons for out of stock items

…in the checkout process

Remove fields in the checkout process
Remove product links for items in cart
Hide shipping on cart
Hide shipping rates when free shipping is available
Remove “What is PayPal?” link and logo

…on the site

Hide price and cart button for selected categories
Remove breadcrumbs
Exclude products in some categories from the shop
Remove Classic Commerce options from Customizer 
Hide custom fields and download boxes on order details 
Hide prices and cart buttons if user not logged in 
Hide SKUs in frontend only, or completely