Tagged: product categories, woocommerce
-
AuthorPosts
-
May 15, 2022 at 6:20 pm #1351859
Hi there,
I contacted you before regarding product categories and categories being all mixed up when using prev/next when looking at products.
I tries using the masonry gallery instead of the product grid but this didn’t seem to do anything either, I was sent this code to implement, but it hasn’t worked at all:
function avf_post_nav_settings_mod($settings)
{
if($settings[‘type’] == ‘product’)
{
$settings[‘taxonomy’] = “product_cat”;
$settings[‘same_category’] = true;
}return $settings;
}
add_filter( ‘avf_post_nav_settings’, ‘avf_post_nav_settings_mod’, 10, 2);Is there nothing that can stop rouge categories appearing?
Thanks, Silvio
May 16, 2022 at 6:09 am #1351897Hey Silvio,
Thank you for the inquiry.
The filter above should work properly if the products belong to a single category. This will allow the post or product navigation to filter only the products that belong to that single category. Unfortunately, it doesn’t really work really well if the products have multiple categories or if the products share the same categories.
Do the products share the same categories? For example, on a site with two models of a table, one is wood and another is metal, but both share the same category called furniture, the post navigation will not really work if you are trying to filter through a single category. Since the table models (wood and metal) share the same category (furniture), both products will still be accessible through the post navigation even when you access them through the “wood” or “metal” category pages.
Best regards,
IsmaelMay 16, 2022 at 10:53 am #1351913Hi,
An example of categories is:
New (for new item to show in the main shop page), then a secondary category to identify the items exact category i.e. antique sword (to show in the category page). I have set the category filter in the product module but as once an item is selected, the next/prev function shows many different items from all sorts of categories.Thanks
May 18, 2022 at 7:15 am #1352144Hi,
Thank you for the info.
but as once an item is selected, the next/prev function shows many different items from all sorts of categories.
That is because the products share the same category, which is “New”. As we explained above, the post navigation will filter or display products as long as they belong to the same category.
Best regards,
IsmaelMay 18, 2022 at 11:32 am #1352168Hi Ismael
I have removed all double categories, in other words products only have 1 category. ‘New’ has been removed, as has ‘sold’, so the only identifier for each product is ‘in stock’ or ‘out of stock’. Also, items that are ‘out of stock’ also appear in the prev/next even though the product grid is set to ‘don’t show out of stock’.
I have tried every possible option with the product grid setting/customizer and nothing seems to work, this is not a good e-commerce theme if it cannot at least filter out items that are not required to be seen.
Silvio
May 19, 2022 at 7:07 am #1352234Hi,
Did you set the stock or product inventory status as category? The post navigation will not filter posts based on its inventory. Please provide a link to a product or category page.
Best regards,
IsmaelMay 19, 2022 at 12:34 pm #1352302Hi,
The inventory status is set to ‘catalog & search’, plus woocommerce->inventory is set to ‘Hide out of stock items from the catalog’…Silvio
- This reply was modified 2 years, 6 months ago by silviouk.
May 20, 2022 at 6:20 am #1352372Hi,
Would you mind setting the user role to administrator? We may have to edit the filter in the functions.php file via the Appearance > Theme File Editor panel.
Best regards,
IsmaelMay 20, 2022 at 9:20 am #1352388I’ve reset the user role…
May 23, 2022 at 11:55 am #1352620Hi,
We added this filter in the functions.php file.
function avf_post_nav_settings_mod($settings){ if($settings['type'] == 'product'){ $settings['taxonomy'] = "product_cat"; $settings['same_category'] = true; } return $settings; } add_filter( 'avf_post_nav_settings', 'avf_post_nav_settings_mod', 10, 2);
The post navigation now filters products in the same category but out of stock items will still be included. Please check the product link in the private field.
Related thread: https://kriesi.at/support/topic/next-prev-in-shop-showing-all-categories/#post-1352033
Best regards,
IsmaelMay 23, 2022 at 12:19 pm #1352625Hi,
So I’m back where I started with no solution then…What the client wants is out of stock items to be set in an archive but not come up in prev/next or appear in the category tabs.
Silvio
May 24, 2022 at 7:31 am #1352718Hi,
This is what you asked in your initial post.
I contacted you before regarding product categories and categories being all mixed up when using prev/next when looking at products.
You didn’t mention anything about product stock or inventory status until later. Unfortunately, the post navigation can only filter posts based on category.
Best regards,
IsmaelMay 24, 2022 at 12:15 pm #1352748Hi again,
You said in an earlier post that: ‘That is because the products share the same category, which is “New”. As we explained above, the post navigation will filter or display products as long as they belong to the same category.’
However:
1 – Each product only has one category now.
2 – The ‘Don’t show out of stock’ is selected in the product grid (I also tried masonry too, didn’t work), and yet out of stock items appear.
3 – Even with the code you sent other categories are shown even though each product has 1 category (as advised).It looks to me that the prev/next just turns into a portfolio and not a shop.
Will this be addressed in an update?I have partially solved this issue by making all sold items ‘hidden’, but on scroll through prev/next on the ‘sold’ page, unsold items appear…I do hope there can be an update for this issue.
***Update***
Even hidden products appear on prev/nextThanks, Silvio
- This reply was modified 2 years, 6 months ago by silviouk.
May 25, 2022 at 7:18 am #1352867Hi,
and yet out of stock items appear.
As we explained over and over in our previous replies, the post navigation will still display products even if they are out of stock, as long as they are in the same category regardless of the inventory status.
These are snippets from our previous replies (4 of them).
— As we explained above, the post navigation will filter or display products as long as they belong to the same category.
— The post navigation will not filter posts based on its (product) inventory.
— Unfortunately, the post navigation can only filter posts based on category.
— The post navigation now filters products in the same category but out of stock items will still be included.You may need to look for a different post navigation, possibly by installing a plugin or hire a freelancer developer to create a custom one from scratch with all the functionality that you require.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.