WooCommerce, WordPress

Handy helper function for product listing page in WooCommerce

WooCommerce is a free e-commerce plugin for WordPress. It is designed for small to large-sized organization to sell the good and services online. I am not going to explain everything about WooCommerce here but  list few helper function that makes developer job easier when developing the WooCommerce sites. One, with the basic knowledge of WooCommerce will understand and find the following functions handy.

  1. Function to list the attributes related to the current category product in the archive-product page/product listing page/product

Get the current category Slug in archive-product.php page :

2. Function to count the number of product related to particular category and related attribute terms .

3. Use the aforementioned function in archive-product.php to get the list the attribute and it’s terms related to current category products. I have used form and checkbox, so that I could filter the products based on current category and selected attribute term.   Also, I find symphony HttpFoundation Component handy to get\request the selected attribute terms

4. Get the list of all the attribute terms

5. Don’t forget to submit the form on selecting the attribute terms.






Hits: 41