📌  相关文章
📜  添加到购物车 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:46.040000             🧑  作者: Mango

代码示例2
function remove_loop_button(){
 if (in_array( 10, $product->category_ids))
  remove_action(‘woocommerce_after_shop_loop_item’,‘woocommerce_template_loop_add_to_cart’, 10);
}
add_action(‘init’,’remove_loop_button’);

add_action(‘woocommerce_after_shop_loop_item’,’replace_add_to_cart’);
function replace_add_to_cart() {
global $product;
$link = $product->get_permalink();
echo ‘Try Now’;
}