Php 请重新添加“;“添加到购物车”;用于单个后期追加销售项目的按钮

Php 请重新添加“;“添加到购物车”;用于单个后期追加销售项目的按钮,php,wordpress,button,woocommerce,Php,Wordpress,Button,Woocommerce,我需要帮助 我从我的主商店页面中删除了“添加到购物车”按钮,因为在这种情况下“查看项目”更有意义 以下是我添加到我的child functions.php主题的代码: ` function remove_loop_button(){ remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); } add_action('init','remove_loo

我需要帮助

我从我的主商店页面中删除了“添加到购物车”按钮,因为在这种情况下“查看项目”更有意义

以下是我添加到我的child functions.php主题的代码:

`

function remove_loop_button(){
    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();
    $text = _( 'See Items');
    echo '<a href="'.$link.'" class="button addto_cart_button">See Items</a>';
}
'    remove_action( 'woocommerce_after_single_product_summary',   'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_upsells', 15 );

if ( ! function_exists( 'woocommerce_output_upsells' ) ) {
    if ( ! function_exists( 'woocommerce_output_upsells' ) ) {
    function woocommerce_output_upsells() {
        remove_action('woocommerce_after_shop_loop_item', 'replace_add_to_cart');
        add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
    }
   }    
} '