Home Forums WoodMart support forum Size guide bulk assignments

Size guide bulk assignments

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #121409

    kuhcon
    Participant

    Hi, i created 5 size guides, i attached them to categories but theyvare not showing up at the products in those categories. If i go in the product and assign it there, yes it works. But i have 1000+ products, i need 2 days to go in every product and assign the size guides. Is there any tweak to assign them in all products all at once or I’m doing something wrong?

    #121420

    Hello,

    We shall fix this in our nearest update. Meanwhile please add this code to the functions.php of the child theme

    ` function woodmart_sguide_display( $post_id = false ){
    $post_id = ( $post_id ) ? $post_id : get_the_ID();

    $sguide_post_id = get_post_meta( $post_id, ‘woodmart_sguide_select’ );

    if ( isset( $sguide_post_id[0] ) && $sguide_post_id[0] == ‘disable’ ) return;

    if ( isset( $sguide_post_id[0] ) && !empty( $sguide_post_id[0] ) ){
    $sguide_post_id = $sguide_post_id[0];
    }else{
    $terms = wp_get_post_terms( $post_id, ‘product_cat’ );
    if ( $terms ) {
    foreach( $terms as $term ){
    $sguide_post_meta = get_term_meta( $term->term_id, ‘woodmart_chosen_sguide’ );
    if ( $sguide_post_meta[0] ) {
    $sguide_post_id = $sguide_post_meta[0];
    }else{
    $sguide_post_id = false;
    }
    }
    }
    }
    if ( $sguide_post_id ) {
    $sguide_post = get_post( $sguide_post_id );
    $size_tables = get_post_meta( $sguide_post_id, ‘woodmart_sguide’ );

    woodmart_sguide_display_table_template( $sguide_post, $size_tables );
    }
    }`

    Best Regards

    #121421

    kuhcon
    Participant

    Hi, it does not work this code. Still they can’t be assigned

    #121432

    Hello,

    Sorry, please try once more with this one:

    function woodmart_sguide_display( $post_id = false ){
            $post_id = ( $post_id ) ? $post_id : get_the_ID();
            
            $sguide_post_id = get_post_meta( $post_id, 'woodmart_sguide_select' );
            
            if ( isset( $sguide_post_id[0] ) && $sguide_post_id[0] == 'disable' ) return; 
            
            if ( isset( $sguide_post_id[0] ) && !empty( $sguide_post_id[0] ) ){
                $sguide_post_id = $sguide_post_id[0];
            }else{
                $terms = wp_get_post_terms( $post_id, 'product_cat' );
                if ( $terms ) {
                    foreach( $terms as $term ){
    					$sguide_post_meta = get_term_meta( $term->term_id, 'woodmart_chosen_sguide' );
                        if ( $sguide_post_meta[0] ) {
                            $sguide_post_id = $sguide_post_meta[0];
                        }else{
                            $sguide_post_id = false;
                        }
                    }
                }
            }    
            if ( $sguide_post_id ) {
                $sguide_post = get_post( $sguide_post_id );
                $size_tables = get_post_meta( $sguide_post_id, 'woodmart_sguide' );
                    
                woodmart_sguide_display_table_template( $sguide_post, $size_tables );
            }
        }

    Best Regards

    #121433

    kuhcon
    Participant

    PERFECT!!!! I hope in future this will be fixed with the parent theme.

    Thanks, you are great.

    #121445

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

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

The topic ‘Size guide bulk assignments’ is closed to new replies.