• I attempted to utilize action hooks for adding, updating, and deleting order items, but it proved to be perplexing.

    In wc-order-item-functions.php is this hooks:

    do_action( 'woocommerce_new_order_item', $item_id, $item, $order_id );
    do_action( 'woocommerce_update_order_item', $item_id, $args );
    do_action( 'woocommerce_delete_order_item', $item_id );

    In abstract-wc-order-item-type-data-store.php is this hooks:

    do_action( 'woocommerce_new_order_item', $item->get_id(), $item, $item->get_order_id() );
    do_action( 'woocommerce_update_order_item', $item->get_id(), $item, $item->get_order_id() );
    do_action( 'woocommerce_delete_order_item', $item->get_id() );

    Why these are duplicate? I think is a bug!

Viewing 1 replies (of 1 total)
  • Saif

    (@babylon1999)

    Hello @kobi1,

    Thank you for reaching out!

    It is very common for the same hook to be referenced in multiple templates. In fact, one could argue that the entire purpose of hooks is to reuse or modify existing code so I do not believe this is a bug, unless I am misunderstanding your request. :?)


    As for editing order items, you may find this article useful: https://rudrastyh.com/woocommerce/order-items.html

    Let us know if you have any other questions. :?)

Viewing 1 replies (of 1 total)
  • The topic ‘Repetitive and ambiguous hooks found in the add/update/delete order item process’ is closed to new replies.