• Hi,

    I hooked in on ‘woocommerce_before_calculate_totals’ to add a discount, based on the amount of products a client is buying.

    The shop administrator should be able to manually add an order (in the admin section), with the same discount. Is it possible to automatically calculate the discount in the backend when clicking ‘calculate totals’? The action ‘woocommerce_before_calculate_totals’ is not firing when adding an order manually. Is there another action I should use for this?

    Kind regards,
    Tom

Viewing 1 replies (of 1 total)
  • D Smith a11n

    (@dsmithweb)

    Automattic Happiness Engineer

    Hi Tom!

    Unfortunately, that hook won’t fire for a manual order– it, like many hooks, relies on the front-end cart and checkout processes.

    woocommerce_process_shop_order_meta will fire when the “Save Order” button is pressed, as discussed here.

    
    add_action( 'woocommerce_process_shop_order_meta', 'woocommerce_process_shop_order', 10, 2 );
    function woocommerce_process_shop_order ( $post_id, $post ) {
            // Apply Discount
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Manual Order Discount’ is closed to new replies.