Home › Forums › WoodMart support forum › ‘Variation as product’ by product category
‘Variation as product’ by product category
- This topic has 10 replies, 3 voices, and was last updated 2 years, 4 months ago by
fantasyprints.nl.
-
AuthorPosts
-
October 5, 2022 at 5:44 pm #411063
francoisParticipantHi, is it possible to implement ‘Show single variation’ for specific product categories? E.g. all SHIRTS variations are displayed as individual products on archive pages and all HATS products only display the parent product?
October 6, 2022 at 9:32 am #411179
Artem TemosKeymasterHello,
This option works globally only. It can’t be applied to specific categories in the store.
Kind Regards
October 6, 2022 at 2:54 pm #411312
francoisParticipantIs there a way to apply/exclude it to/from specific attributes via functions.php or custom child version of show-single-variations\*.php?
October 6, 2022 at 3:44 pm #411343
Artem TemosKeymasterYou can try to customize the theme but we don’t have an instruction for this and it is out of our theme support scope.
Kind Regards
October 10, 2022 at 2:25 pm #412499
francoisParticipantHi
In an attempt to address the issue mentioned above, I added the following code to my child functions.php:
function variable_filter( $q ) { $tax_query = (array) $q->get( 'tax_query' ); $tax_query[] = array( 'relation' => 'OR', array( 'relation' => 'AND', array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => array( 'variable' ), 'operator' => 'NOT IN', ), array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'wallpaper' ), ), ), array( 'relation' => 'AND', array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => array( 'variable' ), ), array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'murals' ), ), ), ); $q->set( 'tax_query', $tax_query ); } add_action( 'woocommerce_product_query', 'variable_filter' );
The code had the desired result of only showing parent/variable MURAL products, as well as only showing child/variation WALLPAPER ‘products’ on the shop page.
For MURAL’s, the filter widgets displayed correctly in the shop page widget area, however for WALLPAPER, the price and colour widgets weren’t generated.
Could you advise why this happened and how I could fix this.
Thanks
October 10, 2022 at 2:28 pm #412502
Artem TemosKeymasterSorry, but we don’t know how this code is supposed to work and why it doesn’t work as you expected. Additional customizations like that are out of our theme support scope.
Kind Regards
October 10, 2022 at 2:36 pm #412509
francoisParticipantAre there any plans to enhance your ‘Variation as product’ feature in the near future, to allow for application by product category, taxonomy, etc?
Most of the variation as product plugins already cater for this, but for obvious reasons I would prefer not to have to install additional plugins.
October 11, 2022 at 11:53 am #412724
Artem TemosKeymasterHello,
Could you please specify which plugins did you use with similar functionality for taxonomies?
Kind Regards
October 11, 2022 at 1:43 pm #412768
francoisParticipantOne that I’ve personally used is ‘WooCommerce Show Variations as Single Products’.
Besides exclusions, it would also be great to be able to define where variations should be displayed, e.g. shop, search, etc.
Attachments:
You must be logged in to view attached files.October 11, 2022 at 2:40 pm #412802
Artem TemosKeymasterHello,
Thank you. We will consider extending this functionality in our future updates.
Kind Regards
October 29, 2022 at 11:42 am #417330
fantasyprints.nlParticipantThis is something that I would really like as well…
-
AuthorPosts
- You must be logged in to create new topics. Login / Register