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 | |
| /** | |
| * Restore single product "Free!" on WooCommerce 3.0. | |
| * | |
| * @param string $price Price HTML. | |
| * @param WC_Product $product Product instance. | |
| * @return string. | |
| */ | |
| function my_wc_custom_get_price_html( $price, $product ) { | |
| if ( $product->get_price() == 0 ) { |
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 | |
| /** | |
| * Adds a custom message about how long will take to delivery. | |
| */ | |
| function my_wc_custom_cart_shipping_notice() { | |
| echo '<tr class="shipping-notice"><td colspan="2"><small>'; | |
| _e( '<strong>Atenção:</strong> O prazo de entrega começa a contar a partir da aprovação do pagamento.', 'my-text-domain' ); | |
| echo '</small></td></tr>'; | |
| } |
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
| RewriteEngine On | |
| RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L] |
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 custom_woocommerce_correios_shipping_methods( $rate, $instance_id ) { | |
| // Verifica se esta utilizando a instancia correta, se não estiver para o código. | |
| if ( 99 !== $instance_id ) { | |
| return $rate; | |
| } | |
| $rate['cost'] = 0; | |
| return $rate; |
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 custom_woocommerce_correios_shipping_methods( $rate ) { | |
| if ( isset( WC()->cart->subtotal ) && 100 <= WC()->cart->subtotal ) { | |
| $rate['cost'] = 0; | |
| } | |
| return $rate; | |
| } | |
| add_filter( 'woocommerce_correios_correios-pac_rate', 'custom_woocommerce_correios_shipping_methods' ); |
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 custom_woocommerce_correios_shipping_methods( $rate ) { | |
| $rate['cost'] = 0; | |
| return $rate; | |
| } | |
| add_filter( 'woocommerce_correios_correios-pac_rate', 'custom_woocommerce_correios_shipping_methods' ); |
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 | |
| /** | |
| * Display (Free) when shipping method does not charge any cost. | |
| * | |
| * @param String $label Shipping method label. | |
| * @param WC_Shipping_Rate $method Shipping method data. | |
| * @return string | |
| */ | |
| function my_wc_custom_free_shipping_label( $label, $method ) { | |
| // Only apply when is free and not using the free shipping method. |
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 | |
| /** | |
| * Save the extra register fields. | |
| * | |
| * @param int $customer_id Current customer ID. | |
| */ | |
| function wooc_save_extra_register_fields( $customer_id ) { | |
| if ( isset( $_POST['billing_first_name'] ) ) { | |
| // WordPress default first name field. | |
| update_user_meta( $customer_id, 'first_name', sanitize_text_field( $_POST['billing_first_name'] ) ); |
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 | |
| /** | |
| * Validate the extra register fields. | |
| * | |
| * @param WP_Error $validation_errors Errors. | |
| * @param string $username Current username. | |
| * @param string $email Current email. | |
| * | |
| * @return WP_Error | |
| */ |
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
| RewriteCond %{THE_REQUEST} \s(.*?)\&\;([^\s]*) [NC] | |
| RewriteRule ^ /%1&%2 [L,NE,R] |