📌  相关文章
📜  添加到购物车,链接到产品页面 - PHP 代码示例

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

代码示例1
// First, remove Add to Cart Button
add_action( 'after_setup_theme', 'my_remove_add_to_cart', 99 );
function my_remove_add_to_cart() {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );    
}

// Second, add View Product Button
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_view_product_button', 10 );
function bbloomer_view_product_button() {
    global $product;
    $link = $product->get_permalink();
    echo 'View Product';
}