קוד שמסתיר את כפתורי הרכישה בלבד בכל המקומות האפשריים לפי תנאי :
function pablo_remove_buy_buttons(){
$product = get_product();
if ( has_term( 'samsuungf', 'product_cat') ){
// remove all purchase buttons
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
}
}
add_action( 'wp', 'pablo_remove_buy_buttons' );
ניתן לערוך את התנאי על ידי שינוי הערך של – if ( has_term( 'samsuungf', 'product_cat') ){
אם רוצים לפי תגית בשם apple ךדוגמה אז השינוי יהיה : if ( has_term( 'apple', 'product_tag') ){
שתפו אם עזר גם לכם
📊 נתוני צפיות
סה"כ צפיות: 28
מבקרים ייחודיים: 28
- 🧍 162.158.42.58 (
United States)
- 🧍 104.23.166.132 (
Netherlands)
- 🧍 172.69.223.145 (
France)
- 🧍 172.71.119.63 (
France)
- 🧍 172.71.232.104 (
France)
- 🧍 104.23.229.40 (
United States)
- 🧍 172.68.245.58 (
United States)
- 🧍 172.71.131.86 (
France)
- 🧍 172.71.135.14 (
France)
- 🧍 172.71.135.36 (
France)
- 🧍 172.68.245.91 (
United States)
- 🧍 172.68.245.134 (
United States)
- 🧍 141.101.69.66 (
France)
- 🧍 172.70.43.178 (
United States)
- 🧍 172.70.46.228 (
Netherlands)
- 🧍 172.71.222.250 (
United States)
- 🧍 172.71.126.225 (
France)
- 🧍 172.71.127.30 (
France)
- 🧍 104.23.229.78 (
France)
- 🧍 141.101.96.50 (
France)
- 🧍 172.70.42.207 (
United States)
- 🧍 172.71.190.89 (
United States)
- 🧍 172.70.142.169 (
Singapore)
- 🧍 162.158.90.106 (
United States)
- 🧍 172.71.232.29 (
France)
- 🧍 162.158.41.65 (
United States)
- 🧍 172.70.144.74 (
Brazil)
- 🧍 172.70.82.231 (
United States)