简体   繁体   English

woocommerce交叉销售仅在购物车页面上显示两个随机产品

[英]woocommerce cross sell is only showing two random products on cart page

This is my code on cart page to show the cross-sell products, but the problem is that this is showing only two random products. 这是我在购物车页面上的代码,用于显示交叉销售的产品,但问题是,这仅显示了两个随机产品。 I want to show more that two products. 我想展示更多这两种产品。

I want to show all cross and upsell of the products that are currently in cart. 我想显示当前购物车中所有产品的交叉销售和追加销售。

This is the code: 这是代码:

echo woocommerce_cross_sell_display();

To display all the cross sells product, you can use the woocommerce_cross_sells_total filter with this code: 要显示所有交叉销售产品,可以使用带有以下代码的woocommerce_cross_sells_total过滤器:

add_filter('woocommerce_cross_sells_total', 'cross_sells_limit');
function cross_sells_limit() {
    return -1;
}

For the up sells product, you just have to use the woocommerce_upsell_display function with no number of product limit already. 对于畅销产品,您只需要使用woocommerce_upsell_display函数而没有产品数量限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM