Home Forums WoodMart support forum ‘Variation as product’ by product category

‘Variation as product’ by product category

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #411063

    francois
    Participant

    Hi, 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?

    #411179

    Artem Temos
    Keymaster

    Hello,

    This option works globally only. It can’t be applied to specific categories in the store.

    Kind Regards

    #411312

    francois
    Participant

    Is there a way to apply/exclude it to/from specific attributes via functions.php or custom child version of show-single-variations\*.php?

    #411343

    Artem Temos
    Keymaster

    You 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

    #412499

    francois
    Participant

    Hi

    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

    #412502

    Artem Temos
    Keymaster

    Sorry, 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

    #412509

    francois
    Participant

    Are 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.

    #412724

    Artem Temos
    Keymaster

    Hello,

    Could you please specify which plugins did you use with similar functionality for taxonomies?

    Kind Regards

    #412768

    francois
    Participant

    One 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.
    #412802

    Artem Temos
    Keymaster

    Hello,

    Thank you. We will consider extending this functionality in our future updates.

    Kind Regards

    #417330

    fantasyprints.nl
    Participant

    This is something that I would really like as well…

Viewing 11 posts - 1 through 11 (of 11 total)