This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Function - Remove Loop/Single Button Add to Cart | |
| */ | |
| add_action('init','remove_add_to_cart'); | |
| function remove_add_to_cart(){ | |
| if(is_user_logged_in()){}else{ | |
| 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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Function - Show the price only after logging | |
| */ | |
| add_filter('woocommerce_get_price_html','show_price_logged'); | |
| function show_price_logged($price){ | |
| if( is_user_logged_in() ){ | |
| return $price; | |
| } else { | |
| return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '" title="Já tenho Conta" class="btn-myaccount">Já tenho Conta</a> ou <a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '" title="Registrar para visualizar o preço!" class="btn-registrar">Registrar para visualizar o preço!</a>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Remove o Field de Informação adicional | |
| add_filter( 'woocommerce_checkout_fields' , 'alter_woocommerce_checkout_fields' ); | |
| function alter_woocommerce_checkout_fields( $fields ) { | |
| unset($fields['order']['order_comments']); | |
| return $fields; | |
| } | |
| // Remove o título de Informação adicional | |
| add_filter( 'woocommerce_enable_order_notes_field', '__return_false' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* add rel prettyphoto to all images */ | |
| function autoadd_rel_prettyPhoto($content) { | |
| global $post; | |
| $pattern = "/(<a(?![^>]*?data-rel=['\"]prettyPhoto.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png)['\"][^\>]*)>/i"; | |
| $replacement = '$1 data-rel="prettyPhoto['.$post->ID.']">'; | |
| $content = preg_replace($pattern, $replacement, $content); | |
| return $content; | |
| } | |
| add_filter("the_content","autoadd_rel_prettyPhoto"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Hide dimensions in Additional Information tab | |
| add_filter( 'wc_product_enable_dimensions_display', '__return_false' ); | |
| //Hide Additional Information tab | |
| function custom_woocommerce_product_tabs( $tabs ) { | |
| if ( isset( $tabs['additional_information'] ) ) { | |
| unset( $tabs['additional_information'] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Custom sorting options | |
| add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); | |
| function custom_woocommerce_get_catalog_ordering_args( $args ) { | |
| $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); | |
| if ('title_asc' == $orderby_value) { | |
| $args['orderby'] = 'title'; | |
| $args['order'] = 'ASC'; | |
| $args['meta_key'] = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Adding a hook callback. | |
| add_filter( 'woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby' ); | |
| add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' ); | |
| function custom_woocommerce_catalog_orderby( $sortby ) { | |
| $sortby['title_asc'] = __('Alphabetical - (A - Z)', 'your-theme'); | |
| $sortby['title_desc'] = __('Alphabetical - (Z - A)', 'your-theme'); | |
| return $sortby; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Função para adicionar um único item por carrinho | |
| */ | |
| function woo_unico_produto( $cart_item_data ) { | |
| global $woocommerce; | |
| $woocommerce->cart->empty_cart(); | |
| return $cart_item_data; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add symbol United Arab Emirates Dirham | |
| add_filter( 'woocommerce_currencies', 'add_custom_currency' ); | |
| function add_custom_currency( $currencies ) { | |
| $currencies['AED'] = __( 'United Arab Emirates Dirham', 'woocommerce' ); | |
| return $currencies; | |
| } | |
| add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2); | |
| function add_custom_currency_symbol( $currency_symbol, $currency ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // allow AED for WooCommerce | |
| add_filter( 'woocommerce_paypal_supported_currencies', 'paypal_aed_current' ); | |
| function paypal_aed_current($currency_array) { | |
| $currency_array[] = 'AED'; | |
| return $currency_array; | |
| } |
OlderNewer