check shipping amount in woocommerce_after_checkout_validation?

Question

I am using a third-party shipping plugin. Sometimes, this plugin somehow acts up, and only charges the client something like 1$.

I’d like to add a sanity check before the order is accepted, that the shipping amount should at least be e.g. 3$.

It seems that I should hook into woocommerce_after_checkout_validation to do this there.

But the shipping amount doesn’t seem to be in $_POST – the only thing of interest is maybe ‘shipping_method’, but there’s no amount to be seen (i just used flat rate as a test):

["shipping_method"]=>
  array(1) {
    [0]=>
    string(11) "flat_rate:4"
  }

How can I look up how much shipping is planned to being charged on the order that has just been submitted?

0
, Moritz von Schweinitz 3 years 2020-07-20T19:10:26-05:00 0 Answers 57 views 0

Leave an answer

Browse
Browse