• Resolved lyle

    (@lyle)


    Hey guys!
    thanks for the great plugin. Ive recently come to learn of the “Order Item ID” and realized if woocommerce could send this so shipstation was able to make use of it, this would save immense hours (as we have different tracking #s for diff items, and some even ship from diff places)

    Would the code below (inserted into the theme functions.php be the place to make this happen? Im very limited in coding ability but from what ive read this should be do-able:

    // This is for custom field 3
    add_filter( ‘woocommerce_shipstation_export_custom_field_3’, ‘shipstation_custom_field_3’ );

    function shipstation_custom_field_3() {
    return ‘_meta_key_2’; // Replace this with the key of your custom field
    }

    is there anyone who can mod that code and let me know if what i read from shipstation is on the right path, if i am tryin to get each items ‘unique item id #’?

    thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter lyle

    (@lyle)

    adding this didnt seem to work.. anyone able to help on this one?

    add_filter( 'woocommerce_shipstation_export_custom_field_2', 'shipstation_custom_field_2' );
    
    function shipstation_custom_field_2() {
    global $post;
    $order = wc_get_order( $post->ID );
    $items = $order->get_items();
    
    foreach ( $order->get_items() as $item ) {
    
    // Compatibility for woocommerce 3+
    $order_item_id = version_compare( WC_VERSION, '3.0', '<' ) ? $item['product_id'] : $item->get_product_id();
    
    }
    
    }
    Plugin Support Mike Straw

    (@mikestraw)

    Hi @lyle ,

    I’m not quite sure what you mean, as the Order ID is already part of the interface.

    You access that order ID via the woocommerce_shipstation_get_order_id filter:

    
    		return apply_filters( 'woocommerce_shipstation_get_order_id', absint( $order_id ) );
    

    Hope that helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Have export include order item id meta data’ is closed to new replies.