Woocommerce更改产品档案库中未登录用户的产品图像URL

时间:2020-05-29 07:39:28

标签: woocommerce

我想为归档页面上未登录的用户更改产品映像ahref。

我将以下代码用于“添加到购物车”按钮。但是需要有关产品图片的帮助。

add_action('init','bbloomer_hide_price_add_cart_not_logged_in');

/**
 * @snippet       Hide Price & Add to Cart for Logged Out Users
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=299
 * @compatible    WooCommerce 3.6.2
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'init', 'bbloomer_hide_price_add_cart_not_logged_in' );

function bbloomer_hide_price_add_cart_not_logged_in() {   
if ( ! is_user_logged_in() ) {      
 remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
 remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );   
 add_action( 'woocommerce_single_product_summary', 'bbloomer_print_login_to_see', 31 );
 add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_print_login_to_see', 11 );
}
}

function bbloomer_print_login_to_see() {
echo '<a href="#" class="login-side-opener button product_type_simple add_to_cart_button basel-tooltip"><span class="basel-tooltip-label">Select Option</span>Select Option</a>';
}

0 个答案:

没有答案
相关问题