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 | |
/** | |
* @version 2.0.0 | |
* @author Luiz Paulo Bills <[email protected]> | |
*/ | |
add_filter( 'woocommerce_variable_sale_price_html', 'lpb_wc_variable_product_price_html', 10, 2 ); | |
add_filter( 'woocommerce_variable_price_html','lpb_wc_variable_product_price_html', 10, 2 ); | |
function lpb_wc_variable_product_price_html ( $html, $product ) { | |
$min_price = $product->get_variation_regular_price( 'min', true ); |
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_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 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_filter( 'woocommerce_available_payment_gateways', 'lpb_remove_other_payment_options_for_local_pickup' ); | |
function lpb_remove_other_payment_options_for_local_pickup ( $gateways ) { | |
$chosen_shipping_rates = WC()->session->get( 'chosen_shipping_methods' ); | |
if ( ! empty( $chosen_shipping_rates ) && strpos( $chosen_shipping_rates[0], 'local_pickup' ) !== false ) { | |
// disable payment | |
add_filter( 'woocommerce_cart_needs_payment', '__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
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 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 | |
/** | |
* Produces cleaner filenames for uploads | |
* | |
* @author WP Artisan https://wpartisan.me/ | |
* | |
* @param string $filename | |
* @return string | |
*/ |
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 | |
/** | |
* @version 1.0.0 | |
* @author Luiz Paulo Bills <[email protected]> | |
*/ | |
add_filter( 'woocommerce_get_price_html', 'lpb_wc_display_free_price', 99, 2 ); | |
function lpb_wc_display_free_price ( $price, $product ) { | |
if ( $product->get_price() == 0 ) { | |
$label = 'Grátis'; | |
$template = '<span class="woocommerce-Price-amount amount free">%s</span>'; |
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 | |
/** | |
* @author Luiz Paulo Bills <[email protected]> | |
* @version 1.0.0 | |
*/ | |
add_filter( 'woocommerce_email_customer_details_fields', 'lpb_email_with_extra_fields', 10, 3 ); | |
function lpb_email_with_extra_fields ( $fields, $sent_to_admin, $order ) { | |
$order_id = $order->get_id(); | |
$extra_fields = array( | |
'Celular' => 'billing_cellphone', |
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
define("PV_ATTRIBUTE", "vendor"); | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
/** | |
* Check if WooCommerce is active | |
*/ | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
if ( ! class_exists( 'TH_Shipping_Options' ) ) { | |
class TH_Shipping_Options { | |
/** |
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_filter( 'woocommerce_admin_meta_boxes_variations_per_page', 'lpb_woocommerce_admin_meta_boxes_variations_per_page' ); | |
function lpb_woocommerce_admin_meta_boxes_variations_per_page ( $per_page ) { | |
return 12; // change this value | |
} |
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
add_filter( 'woocommerce_package_rates', 'lpb_change_correios_pac_cost', 10, 2 ); | |
function lpb_change_correios_pac_cost ( $rates, $package ) { | |
foreach ( $rates as $rate) { | |
if ( $rate->method_id === 'correios-pac' ) { | |
$rate->cost = 20; | |
} | |
} | |
return $rates; | |
} |