Depot ID v REST API
-
Dobry den,
po prechode z WPify na Packeta plugin nam prestalo korektne fungovat prepojenie na externy system, ktory si udaje o ZBOXe vytahoval cez Woo API.
V podstate jedina chybajuca vec je to Depot ID, ktore viem, ze sa uz neuklada ako meta do objednavky ale do samostatnej tabulky.
Ak by s tym tiez mal niekto problem, tak aktualne fix na to (staci dat do functions.php) vyzera takto (ak sa nezmeni struktura DB):
function woo_rest_api_packeta_id( $response, $object, $request ) { global $wpdb; if ( !$object instanceof \WC_Order ) { return $response; } $packeta_data = $wpdb->get_row( $wpdb->prepare( "SELECT
point_id
,carrier_id
FROM {$wpdb->prefix}packetery_order WHERE id = %d", $object->id ) ); if ( ! $packeta_data ) { return $response; } $response->data['meta_data'][] = [ 'key' => '_packeta_id', 'value' => $packeta_data->point_id, ]; $response->data['meta_data'][] = [ 'key' => '_packeta_carrier_id', 'value' => $packeta_data->carrier_id, ]; return $response; } add_filter( 'woocommerce_rest_prepare_shop_order_object', 'woo_rest_api_packeta_id', 20, 3 );Neviem, ci toto ma zmysel pridavat do pluginu, ale mozno nejake wiki pre ludi co pouzivaju napojenia na externe systemy a nevedomky posielaju kurierov na adresy ZBOXov ??
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Depot ID v REST API’ is closed to new replies.