Bin e padrões para validação de cartão de crédito.
Bandeira | Começa com | Máximo de número | Máximo de número cvc |
---|---|---|---|
Visa | 4 | 13,16 | 3 |
Mastercard | 5 | 16 | 3 |
function custom_variable_price_html( $price, $product ) { | |
$price = ''; | |
if ( ! $product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) { | |
$price .= '<span class="from">' . __( 'A partir de' ) . ' </span>'; | |
} | |
$price .= woocommerce_price( $product->get_price() ); | |
if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) { |
<?php | |
//wp_localize_script by default passes everything in as strings so for booleans and integers when being referenced in your javascript you need to do some trickery | |
//Example 1 - passing in booleans as strings | |
$options = get_option('ng_slicknavmenu'); | |
// Add PHP plugin variables to the $params[] array to pass to jQuery | |
$data = array ( | |
'ng_slicknav_menu' => $options['ng_slicknav_menu'], | |
'ng_slicknav_position' => $options['ng_slicknav_position'], |
<?php echo file_get_contents( get_stylesheet_directory_uri() . '/img/icons/your-logo-file.svg' ); ?> |
/* ---------------------------------------------------------- */ | |
/* */ | |
/* A media query that captures: */ | |
/* */ | |
/* - Retina iOS devices */ | |
/* - Retina Macs running Safari */ | |
/* - High DPI Windows PCs running IE 8 and above */ | |
/* - Low DPI Windows PCs running IE, zoomed in */ | |
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */ | |
/* - Android hdpi devices and above */ |
<?php | |
/** | |
* Custom nav walker | |
* | |
* Custom nav walker to assign icons to menu items. | |
*/ | |
class FA_Icon_Walker extends Walker_Nav_Menu | |
{ | |
/** |
<?php | |
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1); | |
function filter_gateways( $gateways ) { | |
$method = WC()->session->get( 'chosen_shipping_methods' ); | |
// get the value of the radio button on the checkout page | |
if ( 'flat_rate:1' != $method[0] ) { | |
unset( $gateways['paypal'] ); | |
} |
<?php | |
/** | |
* wc_direct_link_to_product_tabs | |
* | |
* Allows you to create custom URLs to activate product tabs by default, directly from the URL | |
* ex: http://mysite.com/my-product-name#reviews | |
*/ | |
function wc_direct_link_to_product_tabs() { | |
if( is_product() ) { | |
?> |
<?php | |
/** | |
* Get user's first and last name, else just their first name, else their | |
* display name. Defalts to the current user if $user_id is not provided. | |
* | |
* @param mixed $user_id The user ID or object. Default is current user. | |
* @return string The user's name. | |
*/ | |
function km_get_users_name( $user_id = null ) { |