This file contains 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 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 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 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 Options | |
add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_remove_filter' ); | |
function custom_woocommerce_remove_filter( $catalog_orderby ) { | |
unset( $catalog_orderby['popularity'] ); | |
unset( $catalog_orderby['rating'] ); | |
unset( $catalog_orderby['price'] ); | |
unset( $catalog_orderby['price-desc'] ); | |
return $catalog_orderby; | |
} |
This file contains 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 | |
/** | |
* Brazillian states | |
* Function - Vender Somente para Estados Específicos - WooCommerce | |
*/ | |
function wc_especifico_estado( $states ) { | |
$states['BR'] = array( | |
'SP' => __( 'São Paulo', 'woocommerce' ), | |
'RJ' => __( 'Rio de Janeiro', 'woocommerce' ), | |
); |
This file contains 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 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 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; | |
} |
This file contains 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 single post format template | |
* Reference: https://codex.wordpress.org/Function_Reference/get_post_format | |
*/ | |
function chr_custom_single_post_format( $template ) { | |
if ( is_single() && has_post_format() ) { | |
$post_format_template = locate_template( 'single-' . get_post_format() . '.php' ); | |
if ( $post_format_template ) { | |
$template = $post_format_template; |
This file contains 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
$(function() { | |
$('.classVerticalAlign').css({ | |
'position' : 'absolute', | |
'left' : '50%', | |
'top' : '50%', | |
'margin-left' : -$('.classVerticalAlign').outerWidth()/2, | |
'margin-top' : -$('.classVerticalAlign').outerHeight()/2 | |
}); | |
}); |