Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[ShipStation] Export Custom Field Data to ShipStation
// Add this code to your theme functions.php file or a custom plugin
add_filter( 'woocommerce_shipstation_export_custom_field_2', 'shipstation_custom_field_2' );
function shipstation_custom_field_2() {
return '_meta_key'; // Replace this with the key of your custom field
}
// 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
}
@tonykim5

This comment has been minimized.

Copy link

tonykim5 commented Sep 21, 2019

Has anyone tested this code recently? I copied it exactly, only changing the meta key, and it does not work for me. I confirmed there is a value for the meta key I used.

@abuntly

This comment has been minimized.

Copy link

abuntly commented Sep 24, 2019

Has anyone tested this code recently? I copied it exactly, only changing the meta key, and it does not work for me. I confirmed there is a value for the meta key I used.

I tried it, worked without issue.

I would like to see how to export in to "Internal Notes" in shipstation.. I need to send notes often to the warehouse team about an order..

@evantishuk

This comment has been minimized.

Copy link

evantishuk commented Oct 1, 2019

NOTE: custom_field_1 is locked to the coupon code(s) in class-wc-shipstation-api-export.php @ around line 149:

$this->xml_append( $order_xml, 'CustomField1', implode( ' | ', version_compare( WC_VERSION, '3.7', 'ge' ) ? $order->get_coupon_codes() : $order->get_used_coupons() ) );

@woocommerce Why not follow the same pattern as custom field 2 and 3, but default the meta key to the coupon code? It'd work the same out of the box and allow developers to re-map the all the custom fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.