• Hello,

    I need to have custom script run (to send data to an external API) when a customer confirms an order.

    Currently I have placed it inside class-wc-checkout.php, inside
    public function create_order()
    due to time constrains – fix it now, we’ll optimize later.

    Half is inside
    foreach (WC()->cart->get_cart() as $cart_item_key => $values)
    to get ID, quantity and SKU (from database) about each item and if it needs to be send to the API (not all items need to be sent). The other half is under the function, getting custom field data, if needed, from $this->posted (using woocommerce checkout manager).

    It works, but I know it’s bad practice, so my question is:

    How can I make it as a stand-alone plugin so I don’t have to edit woocommerce files?

    Regards,
    Stelios

    • This topic was modified 9 years, 2 months ago by penguana.
    • This topic was modified 9 years, 2 months ago by penguana.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Adding custom script after customer submits order’ is closed to new replies.