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
// array utils | |
// ================================================================================================= | |
const combine = (...arrays) => [].concat(...arrays); | |
const compact = arr => arr.filter(Boolean); | |
const contains = (() => Array.prototype.includes | |
? (arr, value) => arr.includes(value) | |
: (arr, value) => arr.some(el => el === value) |
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
add_filter( 'woocommerce_checkout_fields' , 'prefix_remove_some_checkout_fields' ); | |
function prefix_remove_some_checkout_fields( $fields ) { | |
if ( $_GET['lang'] === 'en' ) { | |
unset( $fields['billing']['billing_persontype'] ); | |
unset( $fields['billing']['billing_cpf'] ); | |
unset( $fields['billing']['billing_cnpj'] ); | |
} | |
return $fields; | |
} |
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_filter( 'wp_nav_menu_args', 'custom_change_primary_menu' ); | |
function custom_change_primary_menu ( $args ) { | |
if ( $args['theme_location'] === 'primary' ) { | |
$args['menu'] = 'Menu 2'; | |
} | |
return $args; | |
} |
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 | |
/** | |
* @version 1.0.1 | |
*/ | |
add_filter( 'woocommerce_get_price_html', 'custom_variable_price_html', 10, 2 ); | |
function custom_variable_price_html( $price, $product ) { | |
if ( ! $product->is_type( 'variable' ) || $product->get_price() === '') return $price; | |
$result = ''; | |
$prices = $product->get_variation_prices( true ); |
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_filter( 'woocommerce_product_tabs', 'lpb_wc_remove_reviews_tab', 98 ); | |
function lpb_wc_remove_reviews_tab ( $tabs ) { | |
unset($tabs['reviews']); | |
return $tabs; | |
} |
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_filter( 'woocommerce_checkout_fields' , 'lpb_change_address_number_field_input_type', 999 ); | |
function lpb_change_address_number_field_input_type ( $fields ) { | |
$fields['billing']['billing_number']['type'] = 'number'; | |
$fields['shipping']['shipping_number']['type'] = 'number'; | |
return $fields; | |
} |
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_filter( 'style_loader_src', 'generate_remove_cssjs_ver', 10, 2 ); | |
add_filter( 'script_loader_src', 'generate_remove_cssjs_ver', 10, 2 ); | |
function generate_remove_cssjs_ver( $src ) { | |
if( strpos( $src, '?ver=' ) ) $src = remove_query_arg( 'ver', $src ); | |
return $src; | |
} | |
add_action( 'init', 'generate_disable_wp_emojicons' ); |
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
add_filter( 'woocommerce_get_price_html', 'lpb_wc_add_sale_discount', 99, 2 ); | |
function lpb_wc_add_sale_discount ( $price, $product ) { | |
if ( ( ! $product->is_type( 'variable' ) && is_single( $product->get_id() ) ) | |
|| ( $product->is_type( 'variation' ) && is_single( $product->get_parent_id() ) ) ) | |
{ | |
if ( $product->is_on_sale() ) { | |
$message = __( 'economize %s', 'lpb-sale-discount' ); | |
$amount = wc_price( $product->get_regular_price() - $product->get_sale_price() ); | |
$price .= ' <small class="sale-discount">' . sprintf( $message, $amount ) . '</small>'; |
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 | |
/** | |
* Produces cleaner filenames for uploads | |
* | |
* @author WP Artisan https://wpartisan.me/ | |
* | |
* @param string $filename | |
* @return string | |
*/ |
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_action( 'woocommerce_check_cart_items', 'lpb_free_shipping_cart_notice' ); | |
function lpb_free_shipping_cart_notice () { | |
if ( ! is_cart() ) return; | |
// mude o valor 150 para o valor mínimo do frete grátis | |
$free_shipping_amount = 150; | |
// modelo da mensagem (não remova o "%s") |
OlderNewer