This file contains hidden or 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 the Coupon field on WooCommerce cart page. | |
*/ | |
function my_woocommerce_coupons_enabled( $enabled ) { | |
if ( is_cart() ) { | |
$enabled = false; | |
} | |
return $enabled; | |
} |
This file contains hidden or 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 | |
/** | |
* Apply a WooCommerce discount code to cart via URL parameter. | |
* This code is adapted from: https://www.webroomtech.com/apply-coupon-via-url-in-woocommerce/ | |
*/ | |
function my_woocommerce_apply_cart_coupon_in_url() { | |
// Return early if WooCommerce or sessions aren't available. | |
if ( ! function_exists( 'WC' ) || ! WC()->session ) { | |
return; | |
} |
This file contains hidden or 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 | |
/** | |
* Allow shortcodes in the WooCommerce Store Notice. | |
*/ | |
function modify_woocommerce_demo_store_notice_allow_shortcodes( $notice_html, $notice ) { | |
$notice_html = '<div class="woocommerce-store-notice demo_store" style="display:none;">' . do_shortcode( wp_kses_post( $notice ) ) . ' <a href="#" class="woocommerce-store-notice__dismiss-link">' . esc_html__( 'Dismiss', 'woocommerce' ) . '</a></div>'; | |
return $notice_html; | |
} | |
add_filter( 'woocommerce_demo_store', 'modify_woocommerce_demo_store_notice_allow_shortcodes', 10, 2 ); |
This file contains hidden or 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 | |
/** | |
* Format WooCommerce Sale Prices for Accessibility. | |
*/ | |
function modify_woocommerce_format_sale_price( $price, $regular_price, $sale_price ) { | |
$price = '<span class="sr-only">Original price</span> <s>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</s> <span class="sr-only">sale price</span> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>'; | |
return $price; | |
} | |
add_filter( 'woocommerce_format_sale_price', 'modify_woocommerce_format_sale_price', 10, 3 ); |
This file contains hidden or 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 | |
/** | |
* Turn off the WooCommerce Store Notice at a specific date and time. | |
*/ | |
function modify_woocommerce_demo_store_turn_off_date( $notice_html ) { | |
// Set the current date variable. | |
$current_date = date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ); | |
// Change this line to set the store notice end date and time variable. | |
$end_date = '2022-06-08 10:00:00'; |
This file contains hidden or 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 | |
/** | |
* Show WooCommerce Store Notice to Not Logged In Visitors Only. | |
*/ | |
function modify_woocommerce_demo_store_non_users_only( $notice_html ) { | |
if ( is_user_logged_in() ) { | |
return ''; | |
} | |
return $notice_html; | |
} |
This file contains hidden or 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 | |
/** | |
* Show WooCommerce Store Notice to Logged In Previous Customers Only. | |
*/ | |
function modify_woocommerce_demo_store_customers_only( $notice_html ) { | |
if ( ! is_user_logged_in() ) { | |
return ''; | |
} | |
// Get the user object. |
This file contains hidden or 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 | |
/** | |
* Use Feather Icons (https://feathericons.com/) in your WordPress site. | |
* | |
* First, save a copy of feather.min.js to a custom plugin. | |
* Get it here: https://unpkg.com/feather-icons | |
* | |
*/ | |
// Enqueue the Feather script file. |
This file contains hidden or 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 | |
/** | |
* Memberlite filters to set custom colors for specific pages. | |
*/ | |
// Filter the primary color on a page with the slug 'free'. | |
function my_memberlite_custom_color_primary( $current_mod ) { | |
if ( ! is_page( 'free' ) ) { | |
return $current_mod; | |
} |