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
/** | |
* Force VAT field to be filled | |
*/ | |
add_action('woocommerce_checkout_process', 'wc_force_vat_field_to_be_not_empty'); | |
function wc_force_vat_field_to_be_not_empty() { | |
global $woocommerce; | |
// Check if set, if its not set add an error. | |
if( $woocommerce->customer->get_country() != 'SE' ) { |
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
function woo_ninja_remove_price_range( $price, $product ) { | |
// Main Price | |
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); | |
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
// Sale Price | |
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); | |
sort( $prices ); | |
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); |
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
function woo_ninja_remove_price_range( $price, $product ) { | |
// Main Price | |
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); | |
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
// Sale Price | |
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); | |
sort( $prices ); | |
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); |
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( 'wp_footer' , 'rc_localize_datepicker' ); | |
/** | |
* Localize datepicker fields | |
* | |
* @access public | |
* @since 1.0 | |
* @return void | |
*/ | |
function rc_localize_datepicker() { |
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_checkout_process', 'wc_force_vat_field_to_be_not_empty'); | |
function wc_force_vat_field_to_be_not_empty() { | |
// Check if set, if its not set add an error. | |
if ( ! $_POST['vat_number']); | |
wc_add_notice( __( 'Please enter your VAT number.' ), 'error' ); | |
} | |
// adding the asterisk (css) |
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_checkout_process', 'wc_force_vat_field_to_be_not_empty'); | |
function wc_force_vat_field_to_be_not_empty() { | |
global $woocommerce; | |
// Define countries where VAT field is mandatory | |
$eu_countries = array('AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SI', 'SK'); | |
// Check if customer is in one of those countries | |
if( in_array( $woocommerce->customer->get_country(), $eu_countries ) ) { |
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
function _rsp_disable_jetpack_infinite_scroll_conditionally() { | |
if ( true === my_conditionals() ) { | |
remove_theme_support( 'infinite-scroll' ); | |
} | |
} | |
add_action( 'template_redirect', '_rsp_disable_jetpack_infinite_scroll_conditionally', 9 ); |
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
function woo_ninja_remove_price_range( $price, $product ) { | |
// Main Price | |
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); | |
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
// Sale Price | |
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); | |
sort( $prices ); | |
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); |
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_currency_symbol', 'change_existing_currency_symbol', 10, 2); | |
function change_existing_currency_symbol( $currency_symbol, $currency ) { | |
switch( $currency ) { | |
case 'USD': $currency_symbol = 'US$'; break; | |
} | |
return $currency_symbol; | |
} |
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
function woo_related_products_limit() { | |
global $product; | |
$args['posts_per_page'] = 6; | |
return $args; | |
} | |
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' ); | |
function jk_related_products_args( $args ) { | |
$args['posts_per_page'] = 6; // 4 related products | |
$args['columns'] = 3; // arranged in 2 columns |
OlderNewer