2 回答

TA貢獻(xiàn)1835條經(jīng)驗(yàn) 獲得超7個(gè)贊
將以下代碼放入functions.php主題文件中。
// Remove links to the product details pages from the product listing page of a WooCommerce store
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );

TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超17個(gè)贊
試試這個(gè):
function remove_direct_link_to_product_page() {
if ( is_product() && is_product_category(array('category-slug') ) ) {
remove_action( ‘woocommerce_before_shop_loop_item’,
‘woocommerce_template_loop_product_link_open’, 10 );
remove_action( ‘woocommerce_after_shop_loop_item’,
‘woocommerce_template_loop_product_link_close’, 5 );
}
}
- 2 回答
- 0 關(guān)注
- 198 瀏覽
添加回答
舉報(bào)