我正在根据以下主题通过AJAX
提交优惠券代码:
Apply WooCommerce Coupon code to checkout
提交coupon
后,我将重定向到另一个页面,并想echo
是否应用了代码,因此我可以检查一切是否按计划进行。
基本上,我将此代码添加到了functions.php
:
if( WC()->cart->get_coupons() ) {
echo "There is an active coupon submitted";
}
else {
echo "There isn't any active coupon submitted";
}
但是,如果输入错误的优惠券代码或没有输入优惠券代码,则无法导航至下一页。没错,但是在下一页上填写正确的优惠券代码后,它会打印"There isn't any active coupon submitted"
。有人有这种可能性吗?
如果能回显在session
中提交的代码,那将是最好的。