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
// Using Repeat | |
const breakNumberIntoObject = (inputNumber) => { | |
if(!Number(inputNumber)) { | |
return; | |
} | |
const inputNumberArray = String(inputNumber).split(''); | |
const output = {}; | |
inputNumberArray.map((num) => { |
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
// Returns number of remaining days to birthday | |
function birthday(inputDate) { | |
const today = new Date(); | |
const birthday = new Date(inputDate); | |
const upcomingBday = new Date(today.getFullYear(), birthday.getMonth(), birthday.getDate()); | |
// if birthday has already passed, set next year as birthday | |
if (today > upcomingBday) { | |
upcomingBday.setFullYear(today.getFullYear() + 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 | |
function get_from_cach() | |
{ | |
$c = wp_cache_get("my_cache_whatever_name", null); | |
if($c == null) | |
{ | |
$c = $my_cache_whatever_value; | |
wp_cache_set( "my_cache_whatever_name", $c, null, 1000); // Last Number is Time In Minutes | |
} | |
return $c; |
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_applied_coupon', 'check_for_individual_discount' ); | |
function check_for_individual_discount() | |
{ | |
global $woocommerce; | |
// Get All Coupons in Cart | |
$cart_coupons = $woocommerce->cart->applied_coupons; | |
$last_element = count($cart_coupons) -1; | |
$last_added_coupon = $cart_coupons[ $last_element ]; //get the last added coupon to the cart |
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_product_tabs', 'woo_remove_product_tabs', 98 ); | |
function woo_remove_product_tabs( $tabs ) { | |
unset( $tabs['description'] ); // Remove the description tab | |
unset( $tabs['reviews'] ); // Remove the reviews tab | |
unset( $tabs['additional_information'] ); // Remove the additional information tab | |
return $tabs; |
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 | |
/** | |
* Order product collections by stock status, instock products first. | |
*/ | |
class iWC_Orderby_Stock_Status | |
{ | |
public function __construct() | |
{ |
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 | |
/** | |
* Calls the class on the post edit screen. | |
*/ | |
function call_mq_product_second_title_metabox() { | |
new mq_product_second_title_metabox(); | |
} | |
if ( is_admin() ) { | |
add_action( 'load-post.php', 'call_mq_product_second_title_metabox' ); |