How to update the order cost calculation programmatically?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #89522
    Guido Martin
    Participant

    Hi there! If I change an extra metadata of an order, I think I need to recalculate the costs, is there any function to call to force the costs calculation for an order?

    Regards!

    #89523
    WPFactory Plugins
    Participant
    Plugin Author

    Hello Guido,

    We have three options on the Advanced section that may suit you:

    – Force costs update on order update
    – Force costs update on order status change
    – Force costs update on new order item

    Anyway, if you want to recalculate all the orders, you can use this option:
    – Tools & Reports > Recalculate orders cost and profit

    #89524
    Guido Martin
    Participant

    but is there any way to force costs recalculation for one specific order using some php code?

    #89525
    WPFactory Plugins
    Participant
    Plugin Author

    Yes, you could use this:

    alg_wc_cog()->core->orders->update_order_items_costs( $order_id, true );
    #89526
    Guido Martin
    Participant

    You guys are the best! I owe you a beer!
    Thanks for your support!

    #89527
    WPFactory Plugins
    Participant
    Plugin Author

    Anytime ๐Ÿ˜‰

    In that case, please consider leaving a review if you are enjoying the plugin/support. It would be much appreciated ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.