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 | |
/* | |
* Auto applies coupon code based on another coupon code and removes all if either is removed | |
*/ | |
function auto_apply_coupon() { | |
$applied_coupon_code = 'Coupon manually applied goes here'; | |
$coupon_code = 'coupon you want auto applied'; | |
if ( WC()->cart->has_discount($applied_coupon_code) ) { |
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 | |
function wc_minimum_shipping_amount() { | |
// Set this variable to specify a minimum shipping value | |
$minimum = 1; | |
$shipping_total = round( WC()->cart->total, 2 ) - round( WC()->cart->subtotal, 2 ); | |
if ( $shipping_total <= $minimum ) { | |
wc_add_notice( | |
sprintf( 'No shipping method applied. Please refresh the page and try again.' | |
), 'error' |
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_action( 'after_setup_theme', 'wc_support' ); | |
function wc_support() { | |
add_theme_support( 'woocommerce' ); | |
add_theme_support( 'wc-product-gallery-zoom' ); | |
add_theme_support( 'wc-product-gallery-lightbox' ); | |
add_theme_support( 'wc-product-gallery-slider' ); | |
} |
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_action( 'woocommerce_before_cart', 'apply_matched_coupons' ); | |
function apply_matched_coupons() { | |
global $woocommerce; | |
$coupon_code = 'JunePromo'; // your coupon code here | |
if ( $woocommerce->cart->has_discount( $coupon_code ) ) return; |
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 | |
// Remove product rating stars from product loop | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); |
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_action( 'woocommerce_before_cart_table', 'cart_continue_shopping_button' ); | |
function cart_continue_shopping_button() { | |
wc_print_notice( __( '<a class="button wc-backward" href="' . esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ) . '" title="Continue Shopping" > ← Continue Shopping</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
<?php | |
function filter_increase_product_variations_per_page() { | |
return 50; | |
} | |
add_filter( 'woocommerce_admin_meta_boxes_variations_per_page', 'filter_increase_product_variations_per_page', 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
<?php | |
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' ); | |
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' ); | |
function wc_minimum_order_amount() { | |
// Set this variable to specify a minimum order value | |
$minimum = 25; | |
if ( WC()->cart->subtotal < $minimum ) { | |
if( is_cart() ) { | |
wc_print_notice( |
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 | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
} |
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 | |
// Hide coupon field | |
function hide_coupon_field( $enabled ) { | |
if ( is_cart() ) { | |
$enabled = false; | |
} | |
return $enabled; | |
} | |
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field' ); |
NewerOlder