• Resolved zunaweb

    (@zunaweb)


    Hi,

    I am having some trouble since updating WC to 3.4.

    The method_id that is saved in the order item meta data is no longer saving the full ID of the method used.

    e.g. previously the method_id per shipping line would be ‘wbs:b4a11a2f_ups_courier_tracked’. Now it is just saving ‘wbs’.

    I understand that in WC 3.4 the method_id and instance_id are being saved separately now. However, the instance ID is always set to 0.

    We have been using the long method_id (‘wbs:b4a11a2f_ups_courier_tracked’) with some 3rd party software via the API to handle shipping etc and need this extra information to identify which method is being used.

    Any ideas what we can do?

    Let me know if you need any more information.

    1. WordPress: 4.9.6, WooCommerce: 3.4.0, Weight Based Shipping: 5.2.0, PHP: 7.0.30.

    2. N/A

    3. I’m testing it with the order:
    Any order using a WBS defined shipping method (not using WC shipping zones)

    4. I expect to see
    method_id: wbs:b4a11a2f_ups_courier_tracked

    5. I do see instead:
    method_id: wbs

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Dan

    (@dangoodman)

    Thank you for the detailed issue description. I’ll check it in a couple of days and update you.

    Thread Starter zunaweb

    (@zunaweb)

    Great, thanks.

    Plugin Author Dan

    (@dangoodman)

    It appears that WooCommerce does actually save instance_id of a selected shipping option in order metadata, if the one was from shipping zones. instance_id is always zero for global shipping methods (pre WC-2.6 style of shipping methods, outside of shipping zones). So, I believe, you can move your WBS rules under one or more shipping zones and use instance_id’s of newly created WBS shipping methods for matching with third-party software.

    Thread Starter zunaweb

    (@zunaweb)

    Thanks for looking it into this Dan.

    I have tried moving a few WBS methods into shipping zones. The problem here is you have to create a shipping instance for each rule which are all labelled ‘Weight based shipping’ in order for each one to have a different instance ID.

    If there a fairly simple way to have the old shipping method ID (e.g. ‘wbs:b4a11a2f_ups_courier_tracked’) saved into a new order item meta field?

    It’s just all the mappings on the 3rd party site used this full ID, and there are a lot of shipping methods.

    I hope that makes sense.

    Thanks again.

    Plugin Author Dan

    (@dangoodman)

    I’m pretty sure you can do that with a custom code snippet. The idea is to hook some WooCommerce action happening during the order placement and add full shipping option id to an order metadata field. That requires some coding skills though.

    Thread Starter zunaweb

    (@zunaweb)

    Thanks again.

    Do you think the ‘woocommerce_thankyou’ action would be good for this? And then grab the Id from WC()->session?

    Sorry for all the questions, I am a developer but have never got this deep into WooCommerce before. And I don’t really know where ‘b4a11a2f_ups_courier_tracked’ comes from but can see that it is in the session table.

    Plugin Author Dan

    (@dangoodman)

    I can’t say for sure off the top of my head. That sounds good to me though.

    Hi Dan,
    Thanks for your replies to this issue so far, but I have the same problem and the solutions offered here are just not practical. I ship through a fulfillment company and suddenly the Shipping ID is WBS:0 for all shipping Rules. I tried to use your suggestion of linking shipping rules to Zones and indeed it gave me a WBS:21 for the first zone I set up. But I need a rule for standard shipping and express shipping to the same zone and that is not possible.

    We really need the Shipping ID to be updated somehow! And I really hope you can help!

    Please keep me updated.

    Plugin Author Dan

    (@dangoodman)

    Hi @henkj,

    You can create two WBS shipping methods in a shipping zone: one for express shipping and another for standard one. That way you will get different shipping options’ ids.

    Hi Dan,
    Yes I can but on the checkout page it only shows one option for each Zone. Since both are Australia in this case.
    Also can you please tell us where the shipping ID is stored so that I can try to use it in PHP?

    Plugin Author Dan

    (@dangoodman)

    @henkj,

    WooCommerce triggers all shipping methods of a matching shipping zone. Please double check your shipping configuration, make sure all shipping methods are active and clear WooCommerce shipping cache.

    Shipping methods ids are assigned upon creation by WooCommerce. You can see it in URL, e.g. http://<domain>/wp-admin/admin.php?page=wc-settings&tab=shipping&instance_id=52, 52 is the id.

    • This reply was modified 7 years, 11 months ago by Dan.
Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘method_id has changed since WC3.4’ is closed to new replies.