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
<?php | |
/* | |
* @version 1.1.0 | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item_title', 'lpb_wc_add_product_options', 9 ); | |
function lpb_wc_add_product_options () { | |
global $post; | |
$product = wc_get_product( $post->ID ); | |
if ( ! $product->is_type( 'variable' ) ) return; | |
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
.shop_table .product-subtotal, | |
.shop_table .product-price { | |
display: none; | |
} |
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 | |
/** | |
* @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( '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
// please, replace the GTM-XXXX | |
add_action( 'wp_head', 'custom_add_google_tag_manager_head', 0 ); | |
function custom_add_google_tag_manager_head () { | |
?> | |
<!-- Google Tag Manager --> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer','GTM-XXXX');</script> |
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_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") |
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; | |
} |
OlderNewer