Embed Snippet on Your Site
Untitled Snippet
{"generator":"Code Snippets v3.6.5.1","date_created":"2024-07-30 20:37","snippets":[{"id":5,"name":"No price","code":"add_action( 'init', 'wpspecial_nascondi_prezzo_agli_utenti_non_registrati' );n nfunction wpspecial_nascondi_prezzo_agli_utenti_non_registrati() { ntif ( ! is_user_logged_in() ) { nttremove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );nttremove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );nttremove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );nttremove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); nttadd_action( 'woocommerce_single_product_summary', 'wpspecial_login_per_visualizzare', 31 );nttadd_action( 'woocommerce_after_shop_loop_item', 'wpspecial_login_per_visualizzare', 11 );nttadd_action('wp_head', 'remove_prices_with_css');nnt}n}n nfunction wpspecial_login_per_visualizzare() {ntecho '' . __('Effettua il login per vedere il prezzo', 'nome_tema') . '';n}nnnfunction remove_prices_with_css(){n?>n.price {display: none !important;}<?phpn};","active":true,"modified":"2023-06-05 08:34:16","revision":"1"}]}
| |
Comments