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( 'flexible_shipping_free_shipping_notice_text_message', function ( $message, $amount ) { | |
return 'Message Example'; | |
}, 10, 2 ); |
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_states', 'fs_add_uae_emirates' ); | |
function fs_add_uae_emirates( $states ) { | |
$states['AE'] = array( | |
'AZ' => __( 'Abu Dhabi', 'woocommerce' ), | |
'AJ' => __( 'Ajman', 'woocommerce' ), | |
'FU' => __( 'Fujairah', 'woocommerce' ), | |
'SH' => __( 'Sharjah', 'woocommerce' ), | |
'DU' => __( 'Dubai', 'woocommerce' ), | |
'RK' => __( 'Ras Al Khaimah', '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
class WPDeskNoShippingMessage { | |
/** | |
* Register hooks. | |
*/ | |
public function add_hooks() { | |
add_filter( 'woocommerce_no_shipping_available_html', [ $this, 'change_message' ] ); | |
add_filter( 'woocommerce_cart_no_shipping_available_html', [ $this, 'change_message' ] ); | |
} | |
/** |
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( 'flexible_shipping_free_shipping_notice_text', 'wpdesk_flexible_shipping_free_shipping_notice_text', 10, 2 ); | |
function wpdesk_flexible_shipping_free_shipping_notice_text( $notice_text, $amount ) { | |
return sprintf( 'You only need %1$s more to get free shipping!', wc_price( $amount ) ); | |
} |
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( 'flexible_shipping_free_shipping_notice_text', 'wpdesk_flexible_shipping_free_shipping_notice_text', 10, 2 ); | |
function wpdesk_flexible_shipping_free_shipping_notice_text( $notice_text, $amount ) { | |
return sprintf( 'Dodaj do koszyka produkty za łączną kwotę %1$s , aby uzyskać darmową wysyłkę!', wc_price( $amount ) ); | |
} |
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
/** | |
* Can validate field by comparing value with other field. | |
*/ | |
class WPDesk_FCF_Validation_Confirm_Field { | |
/** | |
* Field to compare with validated field. | |
* | |
* @var string | |
*/ | |
private $field_to_compare; |
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
/** | |
* Return TRUE if supplied tax ID is valid for supplied country. | |
* | |
* @param string $id Taxation ID, e.g. ATU99999999 for Austria. | |
* @param string $customer_country Country code. | |
* | |
* @return bool | |
*/ | |
function is_eu_vat_number_valid( $id, $customer_country ) { | |
$id = strtoupper( $id ); |
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_action('woocommerce_check_cart_items','check_cart_weight'); | |
function check_cart_weight(){ | |
global $woocommerce; | |
$weight = $woocommerce->cart->cart_contents_weight; | |
if( $weight > 20 ){ | |
wc_add_notice( sprintf( __( 'You have %sKg weight and we allow only 20Kg of weight per order.', 'woocommerce' ), $weight ), 'error' ); | |
} | |
} |