I am attempting to display a WooCommerce product category page based on the current user role. I have created a custom function get_user_role() to get the user role and added the shortcode [user_role]…
Tag: categories
Unset product tabs for specific product categories in woocommerce
I am using the code coming from this answer: Hiding tabs only for some products in WooCommerce single product pages Here is that code: This code works fine to unset or hide tabs from specific products. Instead I would like to unset or hide tabs from specific product categories. How can I do it for product categories? Answer As the
Product category linked terms list related to current product in WooCommerce
I’ve found online a snippet of code that currently lists all categories on this WooCommerce website. How to I make it specific to show the category related to the product they are viewing? Here is the code that I’ve tweaked: Answer There is a more much simpler way: To display it as coma separated string (with a product category links
Allow checkout only when a product of a mandatory category is in cart
I’d like to stop any customer advancing to the checkout if they do not have a particular product category in their basket. I would also like to tell them with an error message that they need to add a certain product. I’ve found some code but cannot it to work. I’ve added it as a code snippet into my Wordpress
Adding a “return to shop” button on single product pages that leads back to product parent category
My client wants to place a “return to shop” button on single product pages in WooCommerce that leads back to the previous page and not the main shop page. I have explained that all browsers have back buttons but they are dead set on having this button. I’ve even mentioned activating breadcrumbs but they don’t like those either. How can
How to display custom sidebar in specific WooCommerce category?
I have specific question about WooCommerce plugin. I am using WooCommerce Product Categories widget to show category menu on the left sidebar. On my website I have a category for special offers (which contains some subcategories and products) and I want other categories to be hidden from Woocommerce Product Categories widget when user opens this “Special Offers” category. I already
Get Category name from Post ID
Is it possible to get the category name of a category given the Post ID, the following code works to get the Category Id, but how can I get the name? Thank! Answer here you go get_the_category( $post->ID ); will return the array of categories of that post you need to loop through the array get_the_category
show only limited categories with a MySQL queries
I have a mysql database in which there is about hundreds of category for photo album. When i display the album using so it will display the last 10 categories but if i want to display only 15 categories in between from that hundreds of category what the query should be? i have try this. here its displaying that category