• Resolved tz1603

    (@tz1603)


    Can you guys help with adding the filter hook omnisend_order_data to

    /manager/class-omnisend-manager.php

    	public static function push_order_to_omnisend( $order_id ) {
    if ( ! self::is_setup() ) {
    return;
    }

    $order_object = Omnisend_Order::create( $order_id );
    if ( ! $order_object ) {
    $message = 'Unable to push Order #' . $order_id . ' to Omnisend. One or more required fields are empty or invalid';
    Omnisend_Logger::log( 'warn', 'orders', '', $message );
    Omnisend_Sync::mark_order_sync_as_skipped( $order_id );
    return;
    }

    $order_array = Omnisend_Helper::clean_model_from_empty_fields( $order_object );

    // Add filter hook here
    $order_array = apply_filters( 'omnisend_order_data', $order_array );


    $verbs_to_try = Omnisend_Sync::was_order_synced_before( $order_id ) ? array( self::VERB_PUT ) : array( self::VERB_POST, self::VERB_PUT );

    foreach ( $verbs_to_try as $verb ) {
    $api_url = $verb == self::VERB_POST ? OMNISEND_API_URL . '/v3/orders' : OMNISEND_API_URL . '/v3/orders/' . $order_id;
    $curl_result = Omnisend_Helper::omnisend_api( $api_url, $verb, $order_array );

    if ( $curl_result['code'] >= 200 && $curl_result['code'] < 300 ) {
    Omnisend_Logger::log( 'info', 'orders', $api_url, "Order #$order_id was successfully pushed to Omnisend." );
    Omnisend_Sync_Stats_Repository::count_item( 'orders' );
    Omnisend_Sync::mark_order_sync_as_synced( $order_id );
    Omnisend_Contact_Resolver::update_by_email( $order_object->email );
    return;
    }

    if ( in_array( $curl_result['code'], self::HTTP_STATUS_CODES_TO_RETRY_POST_IN_PUT ) ) {
    Omnisend_Logger::log( 'warn', 'orders', $api_url, 'Unable to push order #' . $order_id . ' to Omnisend.' . $curl_result['response'] );
    continue;
    }

    if ( $curl_result['code'] == 403 ) {
    Omnisend_Logger::log( 'warn', 'orders', $api_url, "Unable to push order #$order_id to Omnisend. You don't have rights to push orders." );
    break;
    }

    Omnisend_Logger::log( 'warn', 'orders', $api_url, "Unable to push order #$order_id to Omnisend. May be server error. " . $curl_result['response'] );
    break;
    }

    Omnisend_Sync::mark_order_sync_as_error( $order_id );
    }

    Just add the

    // Add filter hook here
    $order_array = apply_filters( ‘omnisend_order_data’, $order_array );

    to the function push_order_to_omnisend in class-omnisend-manager.php.

    So we can make changes to the order data sent to omnisend like for example, the order currency and We need to adjust the order data sent to Omnisend, specifically the order currency and amount. Currently, our store accepts multiple currencies, so the data we’re sending to Omnisend includes various currencies. However, the Omnisend dashboard doesn’t support multiple currencies and treats all amounts as if they were in our default currency. To resolve this, I’d like to manually set the order currency to USD and convert all order amounts to USD before sending them to Omnisend.

Viewing 1 replies (of 1 total)
  • Plugin Support supportomnisend

    (@supportomnisend)

    Hi @tz1603,

    Thank you for sharing your business needs with us on the support forum. We understand that being able to adjust the order data sent to Omnisend — particularly for handling multiple currencies — is important for your setup.

    Your request has been forwarded to our product team, and we will carefully consider it for future improvements. While we cannot commit to a specific timeline for implementation at this moment, we recognize the importance of this feature and will keep it in mind for upcoming updates. We’ll also make sure to keep you informed about any developments regarding this request.

    In the meantime, if there’s anything else we can do to assist you, please feel free to reach out. We appreciate your patience and your continued support.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.