Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress Woocommerce产品包倍增_Wordpress_Woocommerce - Fatal编程技术网

Wordpress Woocommerce产品包倍增

Wordpress Woocommerce产品包倍增,wordpress,woocommerce,Wordpress,Woocommerce,我已经安装了Woocommerce产品包插件,但我遇到了问题。例如: 我的包的设置如下: 当您购买产品A时,您可以选择购买该捆绑包中的产品B和产品C 当我购买4倍产品A和2倍产品B并单击添加到购物车时,我的购物车内容/总数为 4x产品-A 8x产品-B 似乎不管有多少父产品,它都会按可选产品数量乘以自身 希望有人能帮忙。解决了这个问题 我查看了wc-pb-cart.php并查看了功能包\u add\u to\u cart,发现了以下内容: $quantity = $bundled_it

我已经安装了Woocommerce产品包插件,但我遇到了问题。例如:

我的包的设置如下:

当您购买产品A时,您可以选择购买该捆绑包中的产品B和产品C

当我购买4倍产品A和2倍产品B并单击添加到购物车时,我的购物车内容/总数为

4x产品-A 8x产品-B

似乎不管有多少父产品,它都会按可选产品数量乘以自身

希望有人能帮忙。

解决了这个问题

我查看了wc-pb-cart.php并查看了功能包\u add\u to\u cart,发现了以下内容:

$quantity      = $bundled_item->is_sold_individually() ? 1 : $item_quantity * $bundled_item->get_quantity();
因此,我创建了自己的类并将其包含在functions.php中,然后扩展了WC_PB_Cart并调用了我的新函数(同一个函数刚刚删除了*$bundled_item->get_quantity(),这导致了重复

然后我需要在functions.php中删除bundle上的\u操作\u将\u添加到\u购物车

include 'class-cartFeatures.php';
remove_action( 'woocommerce_add_to_cart', array( WC_PB_Cart::instance(), 'bundle_add_to_cart' ), 10, 6 );
add_action( 'woocommerce_add_to_cart', array( new cartFeatures(), 'bundle_add_to_cart_excalibur' ), 10, 6 );