Top Useful WooCommerce Code Snippets

| Last Updated: | In: Featured, WooCommerce, WordPress, WordPress Snippets


Below is the list of some super useful WooCommerce code snippets, which help you while customizing the WooCommerce store. This is the list of some extremely useful snippets. These are the simple action and filters of WooCommerce to change the default functionalities of WooCommerce store.

Top Useful WooCommerce Code Snippets

See the below lists of useful code snippets carefully and use it to your WooCommerce based websites.

How to craete direct link of “Add to cart”

If you want to create a direct link for Add to the cart of any product from the website, then you can create by using the below URL structure:

http://yourwebsite.com/checkout/?add-to-cart=product_id

How to change products listing per page

By default, WooCommerce displayed the 12 products per page, but if you want to change the number of products displayed on the product archive page, then use this below code to your functions.php file in your theme.

Remove breadcrumbs from website

If you do not need the breadcrumbs on your website anymore and want to remove it, then use the below code to your functions.php file in your currently activated theme.

Change “out of stock” text

Don’t like to display the “out of stock” words for your non-inventory products and want to change it by other words like “Sold out”, “Not Available”, or something else, then use the below code at the end of your functions.php file of your current activated theme.

Change number of products displayed per row

You can also change the number of products displayed per row on your archive page by using the below code to your functions.php file of your current activated theme. Below code will override the default number of products per row.

Over to You

Hope these code snippets helped you, If you have any question regarding it, then feel free to add your comments in below comment section. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


You may also like:

Tags: , , , ,