• Resolved klivie

    (@klivie)


    So I’m doing some work sending off our order data to a third party as a JSON array.

    For this, we need to have some mapping between the shipping methods to match the value within the third party system.

    However, all the shipping methods seem to have the same method & instance ids?

    For example, on my checkout I can select all of these flexible shipping options:

    <select name=”shipping_method[0]” data-index=”0″ id=”shipping_method_0″ class=”shipping_method”>
    <option value=”flexible_shipping_10_5″ selected=”selected”>UK 1st Class Signed For: £5.95</option>
    <option value=”flexible_shipping_10_6″>UK Special Delivery: £7.50</option>
    <option value=”flexible_shipping_10_7″>UK Special Delivery – Saturday: £12.50</option>
    <option value=”flexible_shipping_10_10″>Collect from Ragdale Hall</option>
    </select>

    How do i get these individual ids / values with a PHP function? or whichever is the selected option on the checkout.

    I’ve done this:

    foreach($order->get_shipping_methods() as $shipping_item_obj) {}

    But the two functions below don’t seem to be getting the IDS i want (the ones from the dropdown values)

    $shipping_item_obj->get_method_id() always returns “flexible_shipping”
    $shipping_item_obj->get_instance_id() always returns 10;

    Thanks,
    Kurt

Viewing 1 replies (of 1 total)
  • Plugin Author grola

    (@grola)

    Hi,

    information about shipping method is stored in order item meta. You should read _fs_method metadata from $shipping_item_obj.

Viewing 1 replies (of 1 total)
  • The topic ‘Flexible Shipping Method IDs the same’ is closed to new replies.