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
<script> | |
var lottie, animations | |
// Return a promise that resolves to true once animation is loaded | |
async function animationLoaded(animation) { | |
if(animation.isLoaded) { | |
return true | |
} | |
return new Promise((resolve, reject) => { |
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($){ | |
function exportTableToCSV($table, filename) { | |
var $rows = $table.find('tr:has(th), tr:has(td)'), | |
// Temporary delimiter characters unlikely to be typed by keyboard | |
// This is to avoid accidentally splitting the actual contents | |
tmpColDelim = String.fromCharCode(11), // vertical tab character | |
tmpRowDelim = String.fromCharCode(0), // null character |
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( 'template_redirect', 'remove_product_from_cart' ); | |
function remove_product_from_cart() { | |
// Run only in the Cart or Checkout Page | |
if( is_cart() || is_checkout() ) { | |
// Set the product ID to remove | |
$prod_to_remove = 56; | |
// Cycle through each product in the cart | |
foreach( WC()->cart->cart_contents as $prod_in_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
function wc_dropdown_variation_attribute_options( $args = array() ) { | |
global $product; | |
$variations = $product->get_available_variations(); | |
$args = wp_parse_args( apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ), array( | |
'options' => false, | |
'attribute' => false, | |
'product' => false, | |
'selected' => false, | |
'name' => '', |
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 | |
// Manually create entries and send notifications with Gravity Forms | |
$form_id = 10; | |
// add entry | |
$entry = array( | |
"form_id" => $form_id, | |
"1" => "Entry for field ID 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 | |
/** | |
* WooCommerce Extra Feature | |
* -------------------------- | |
* | |
* Send an email each time an order with coupon(s) is completed | |
* The email contains coupon(s) used during checkout process | |
* | |
*/ | |
function woo_email_order_coupons( $order_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_action( 'woocommerce_before_cart', 'apply_matched_coupons' ); | |
function apply_matched_coupons() { | |
global $woocommerce; | |
$coupon_code = '10percent'; // your coupon code here | |
if ( $woocommerce->cart->has_discount( $coupon_code ) ) return; | |
if ( $woocommerce->cart->cart_contents_total >= 500 ) { |
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 to functions.php. Set the redirect to the proper permalink for notice | |
add_action('template_redirect','store_closed'); | |
function store_closed(){ | |
if (!is_admin() && is_woocommerce()){ | |
wp_redirect('/store-closed/'); | |
exit; | |
} |
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 my_login_redirect($redirect_to, $request){ | |
global $user; | |
get_currentuserinfo(); | |
//is there a user to check? | |
if(is_array($user->roles)) | |
{ | |
//check for admins | |
if(in_array("administrator", $user->roles)) | |
return home_url("/wp-admin/"); |