admin管理员组文章数量:1328337
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?
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?
Share Improve this question asked Jul 20, 2020 at 23:29 Moritz von SchweinitzMoritz von Schweinitz 1011 Answer
Reset to default 0Found it!
global $woocommerce;
$shipping_method = $_POST['shipping_method'][0];
$shipping_amount = $woocommerce->cart->get_shipping_total();
本文标签: woocommerce offtopiccheck shipping amount in woocommerceaftercheckoutvalidation
版权声明:本文标题:woocommerce offtopic - check shipping amount in woocommerce_after_checkout_validation? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742245952a2439498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论