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_thankyou', 'cartimize_thank_you_custom_block_details', 100, 100000000000 ); | |
function cartimize_thank_you_custom_block_details(){ | |
?> | |
<section class="woocommerce-block"> | |
<h2>Title goes here</h2> | |
<div> | |
Content goes here | |
</div> | |
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( 'cartimize_get_billing_checkout_fields', 'cartimize_custom_brazil_add_additional_billing_fields' , 10000, 1 ); | |
function cartimize_custom_brazil_add_additional_billing_fields( $fields ){ | |
if ( !isset( $fields['billing_neighborhood'] ) ) { | |
return $fields; | |
} | |
unset( $fields['billing_neighborhood']['is_hidden'] ); | |
unset( $fields['billing_neighborhood']['cartimize_optional_label'] ); |
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
// Shipping full name validation | |
jQuery( document.body ).on( 'cartimize_shipping_full_name_validation', function(event, defaultResult, fieldValue){ | |
//Add your custom code here. Return true or false else it will use default validation | |
//Example: Check fieldValue empty or not | |
if(fieldValue.length === 0 ){ | |
return false; | |
}else{ | |
return 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 | |
// Shipping filed validation | |
add_filter('cartimize_get_shipping_checkout_fields', 'cartimize_modify_shipping_checkout_fields_new', 100, 1); | |
function cartimize_modify_shipping_checkout_fields_new( $checkout_fields ){ | |
if ( isset($checkout_fields['shipping_phone']) && $checkout_fields['shipping_phone']['required'] == true ) { | |
$checkout_fields['shipping_phone'] = $checkout_fields['shipping_phone']; | |
$checkout_fields['shipping_phone']['custom_attributes']['data-parsley-pattern'] = '([0-9]{10})'; | |
} |
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( 'cartimize_full_name_text_label', 'custom_cartimize_full_name_text_label' , 1000, 1 ); | |
function custom_cartimize_full_name_text_label($text){ | |
return 'First name'; | |
} |
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('cartimize_get_billing_checkout_fields', 'cartimize_custom_get_billing_checkout_fields', 10, 1); | |
function cartimize_custom_get_billing_checkout_fields( $value ){ | |
$value['billing_address_1']['parsley_custom_validator']= true; | |
return $value; | |
} | |
add_filter('cartimize_get_shipping_checkout_fields', 'cartimize_custom_get_shipping_checkout_fields', 10, 1); |
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
jQuery( document.body ).on( 'cartimize_shipping_address_1_validation', function(event, defaultResult, fieldValue){ | |
//Your custom code. Return true or false else it will use default validation | |
//Example: Validation for specific countries. | |
var selectedCountry = jQuery("#shipping_country").val(); | |
if(selectedCountry == 'NL' || selectedCountry == 'BEL' || selectedCountry == 'CZE'){ | |
return /\d/.test(fieldValue); | |
} | |
}); |
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('cartimize_front_end_parsley_errors', 'cartimize_custom_cartimize_front_end_parsley_errors', 10, 1); | |
function cartimize_custom_cartimize_front_end_parsley_errors( $value ){ | |
$value['parsley_errors']['shipping_address_1']= "Please enter your street address along with your house number"; | |
$value['parsley_errors']['billing_address_1']= "Please enter your street address along with your house number"; | |
return $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 | |
add_filter( 'cartimize_get_billing_checkout_fields', 'cartimize_address_1_billing_fields_always_show' , 10, 1 ); | |
function cartimize_address_1_billing_fields_always_show( $fields ){ | |
if ( !isset( $fields['billing_address_2'] ) ) { | |
return $fields; | |
} | |
unset( $fields['billing_address_2']['is_hidden'] ); |
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_cart_needs_shipping_address', '__return_true', 50 ); | |
add_filter( 'woocommerce_checkout_fields', 'custom_child_theme_override_checkout_fields', 100); | |
function custom_child_theme_override_checkout_fields($fields) { | |
if (! WC()->cart->needs_shipping()) { | |
foreach ( $fields['shipping'] as $key => $value ) { | |
if ( !in_array( $key, array('shipping_full_name', 'shipping_first_name', 'shipping_last_name') ) && stripos( $key, 'shipping_') !== false ) { | |
unset($fields['shipping'][$key]); | |
} |
OlderNewer