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
/* Change shipping based on total cost purchased and or applied coupons are excluded. */ | |
add_filter( 'woocommerce_shipping_packages', 'hide_flat_rate_if_cart_total_is_greater_than_threshold', 5, 1 ); | |
function hide_flat_rate_if_cart_total_is_greater_than_threshold( $packages ) { | |
$threshold1 = 249; | |
$applied_coupons = WC()->session->get( 'applied_coupons', array() ); | |
$amount = WC()->cart->cart_contents_total; | |
$availableRates = $packages[0]['rates']; | |
$excluded_coupons = array('coupon1', 'coupon2', 'coupon3', 'coupon4', 'coupon5', 'coupon6', 'cooupon7', 'eight', 'nine', 'ten'); | |
$isExcludedCoupon = false; |
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(){ | |
$('.loop').on('initialized.owl.carousel translate.owl.carousel', function(e){ | |
idx = e.item.index; | |
$('.owl-item.active.big').removeClass('big'); | |
$('.owl-item.medium').removeClass('medium'); | |
$('.owl-item').eq(idx).addClass('big'); | |
$('.owl-item').eq(idx-1).addClass('medium'); | |
$('.owl-item').eq(idx+1).addClass('medium'); | |
$('.owl-item').eq(idx+2).addClass('medium'); |
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_shipping_packages', function( $packages ) { | |
$applied_coupons = WC()->session->get( 'applied_coupons', array() ); | |
if ( ! empty( $applied_coupons ) ) { | |
if ( in_array('promocode1', $applied_coupons) || | |
in_array('promocode2', $applied_coupons) | |
) { | |
$free_shipping_id = 'woodiscountfree'; | |
unset($packages[0]['rates'][$free_shipping_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_filter( 'woocommerce_countries_base_postcode', 'force_local_pickup_tax_location_zip' ); | |
function force_local_pickup_tax_location_zip(){ | |
return '90210'; | |
} | |
add_filter( 'woocommerce_countries_base_city', 'force_local_pickup_tax_location_city' ); | |
function force_local_pickup_tax_location_city(){ | |
return 'Beverly Hills'; |
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
$("ul.menu li:has(ul.nav-drop)").hover(function () { | |
$(this).children("a").click(function () { | |
return false; | |
}); | |
}); | |
<ul class="menu"> | |
<li class="menu-item menu-item--current"> | |
<a class="menu-link" href="http://sitzmark.local/about-us/">About Us</a> |
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
/*================= custom wysiwyg editor styles ==============*/ | |
//add custom styles to the WordPress editor | |
function my_custom_styles( $init_array ) { | |
$style_formats = array( | |
// These are the custom styles | |
array( | |
'title' => 'Testimonials', | |
'block' => 'div', | |
'classes' => 'testimonials', |
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('tiny_mce_before_init', function( $a ) { | |
$a["extended_valid_elements"] = 'script'; | |
return $a; | |
}); |
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
// Make coupons invalid at product level | |
add_filter('woocommerce_coupon_is_valid_for_product', 'set_coupon_validity_for_excluded_products', 12, 4); | |
function set_coupon_validity_for_excluded_products($valid, $product, $coupon, $values ){ | |
if( ! count(get_option( '_products_disabled_for_coupons' )) > 0 ) return $valid; | |
$disabled_products = get_option( '_products_disabled_for_coupons' ); | |
if( in_array( $product->get_id(), $disabled_products ) ) | |
$valid = false; | |
return $valid; |
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_package_rates', 'hide_shipping_when_free_is_available', 100 ); | |
function hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
if ( 'free_shipping' === $rate->method_id ) { | |
$free[ $rate_id ] = $rate; | |
break; | |
} | |
} | |
return ! empty( $free ) ? $free : $rates; |
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
/* Change shipping based on cart total and if they they qualify for free shipping */ | |
add_filter( 'woocommerce_package_rates', 'hide_flat_rate_if_cart_total_is_greater_than_threshold', 5, 1 ); | |
function hide_flat_rate_if_cart_total_is_greater_than_threshold( $rates ) { | |
$threshold1 = 249; | |
$amount = WC()->cart->cart_contents_total; | |
if ( $amount > $threshold1 ) { | |
unset( $rates['flat_rate:5'] ); | |
} | |
return $rates; | |
} |
NewerOlder