admin管理员组文章数量:1122846
I have wordpress
setup with woocommerce
.
Now I have set the option Sold individually
to yes check the screenshot
But when I click on the add to cart button of that product and check the value again in admin it got unchecked.
I have even updated the woocommerce but same.
After doing a bit more debug I found that the below code is responsible for changing the value
private static function add_to_cart_handler_simple( $product_id ) {
$quantity = empty( $_REQUEST['quantity'] ) ? 1 : wc_stock_amount( wp_unslash( $_REQUEST['quantity'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
die("aa");
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity ) ) {
wc_add_to_cart_message( array( $product_id => $quantity ), true );
return true;
}
return false;
}
Specially this section
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
As you can see that I have added die("aa");
in the code that prevent value to change but if I place this code after $passed_validation
line the value has changed.
本文标签: pluginssoldindividually value change when add to cart
版权声明:本文标题:plugins - _sold_individually value change when add to cart 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301037a1931037.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论