Home Forums WoodMart support forum error size guide Reply To: error size guide

#317654

Artem Temos
Keymaster

Hello,

Try to add the following PHP code snippet to the child theme functions.php file to fix this

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[0] != 'none' ){
        $sguide_post_id = $sguide_post_id[0];
    }else{
        $terms = wp_get_post_terms( $post_id, 'product_cat' );
        if ( $terms ) {
            foreach( $terms as $term ){
            if ( get_term_meta( $term->term_id, 'woodmart_chosen_sguide', true ) ) {
                    $sguide_post_id = get_term_meta( $term->term_id, 'woodmart_chosen_sguide', true );
                }
            }
        }
    }

    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 );
    }
}

Kind Regards