Home Forums WoodMart support forum Size guide programatically

Size guide programatically

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #263048

    stepap21
    Participant

    Hello,

    I would like to create size guide programatically. Please, can you give me a peace of code which can do this job. For example I have this array :
    $tables = array(
    array(‘Size’, ‘UK’, ‘US’, ‘EU’, ‘Japan’),
    array(‘XS’, ‘6 – 8’, ‘4’, ’34’, ‘7’),
    array(‘S’, ‘8 -10’, ‘6’, ’36’, ‘9’),
    array(‘M’, ’10 – 12′, ‘8’, ’38’, ’11’),
    array(‘L’, ’12 – 14′, ’10’, ’40’, ’13’),
    array(‘XL’, ’14 – 16′, ’12’, ’42’, ’15’),
    array(‘XXL’, ’16 – 28′, ’14’, ’44’, ’17’)
    );
    And I want to save this size guide to $post_id = 123456. Is that possible?

    Thank you very much for any hint.

    #263187

    Hello,

    We have double-check and our dev team suggests this code:

    $tables = array(
        array( 'Size', 'UK', 'US', 'EU', 'Japan' ),
        array( 'XS', '6 - 8', '4', '34', '7' ),
        array( 'S', '8 -10', '6', '36', '9'  ),
        array( 'M', '10 - 12', '8', '38', '11'  ),
        array( 'L', '12 - 14', '10', '40', '13'  ),
        array( 'XL', '14 - 16', '12', '42', '15'  ),
        array( 'XXL', '16 - 28', '14', '44', '17'  )
    );
    update_post_meta( $post_id, 'woodmart_sguide', $tables );

    Please add it into the functions.php of the child theme. You can change it as per your needs.

    Best Regards

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