Support » Plugin: WooCommerce ShipStation Integration » Checking the COD option automatically in Shipstation

  • Resolved miguel1876


    Our woocommerce orders that are marked/payed as COD are not being automatically marked with the “Collect payment on delivery (C.O.D.)” option in Shipstation.
    We contact ed Shipstation and they say that the plugin doesn’t send this info over by default but it can however be set in the plugin’s settings. They say to to navigate to the Custom Field settings and set it to map over the Collect on Delivery preference into Custom field 2. I don’t see such setting in the plugin’s settings page. I am assuming that we will need to use the custom code seen here:

    If that’s the case, how would we do that for the COD payment option at checkout? What would the code look like?

    Can you please help?

    We have been trying to figure this out for several weeks now.

    Thanks so much

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Michael


    Automattic Happiness Engineer

    Hi there,

    When an order is exported to ShipStation, and paid for using the Cash on delivery payment method, the following two lines are included:

    <OrderPaymentMethodTitle>Cash on delivery</OrderPaymentMethodTitle>

    If that information needs to be specifically added in one of the Custom Fields. It’s possible to add the value in the Custom Field 2 as well. For that you would need to use a code snippet something like this:

    add_filter( 'woocommerce_shipstation_export_custom_field_2', '__return_true' );
    add_filter( 'woocommerce_shipstation_export_custom_field_2_value', 'woo_shipstation_custom_field_2_value', 10, 2 );
    function woo_shipstation_custom_field_2_value( $value, $order_id ) {
    	$order = wc_get_order( $order_id );
    	if ( $order ) {
    		return $order->get_payment_method_title();
    	return $value;

    However, whether that field would automatically check the option for Cash On Delivery on the ShipStation side would be something you would need to clarify with them and exactly what information is expected in the XML.

    In their documentation I see the following note:

    ShipStation currently only supports C.O.D. for FedEx, UPS, and Canada Post shipments.

    Is that one of the shipping options you are using?

    Thread Starter miguel1876


    Hi there

    Yes and this helps me tremendously! With this I can create an Automation Rule in Shipstation which will automatically check the “Collect Payment on Delivery” option for COD orders.

    Thank you so much for your helpful reply.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Checking the COD option automatically in Shipstation’ is closed to new replies.