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
🌞 Morning 170 commits █████▍░░░░░░░░░░░░░░░ 26.1% | |
🌆 Daytime 288 commits █████████▎░░░░░░░░░░░ 44.2% | |
🌃 Evening 187 commits ██████░░░░░░░░░░░░░░░ 28.7% | |
🌙 Night 6 commits ▏░░░░░░░░░░░░░░░░░░░░ 0.9% |
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
/* Do not send completed email if shipping is local pickup */ | |
function custom_email_completed_order($enabled, $order) { | |
if(!is_null($order) && $order->has_shipping_method('local_pickup')) { | |
return false; | |
} | |
return $enabled; | |
} | |
add_filter('woocommerce_email_enabled_customer_completed_order', 'custom_email_completed_order', 10, 2); |
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
/* Products stock default */ | |
function manage_stock_default( $post_id ) { | |
$num = 1; | |
$_product = wc_get_product( $post_id ); | |
if ($_product->is_type('variable')) { | |
$variation_ids = $_product->get_children(); | |
$num = count($variation_ids); | |
} | |
update_post_meta($post_id, '_manage_stock', 'yes'); | |
update_post_meta($post_id, '_stock', strval($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
/* Woocommerce category for logged-in users */ | |
function category_redirect() { | |
$category = ''; | |
if (!is_user_logged_in() && is_woocommerce() && is_product_category($category) ) { | |
wp_redirect(get_permalink(get_option('woocommerce_myaccount_page_id'))); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'category_redirect'); |
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
/* Show attributes on shop page */ | |
function show_attributes_shop_page() { | |
global $product; | |
$attr_name = ''; | |
$attr = $product->get_attribute('pa_' . $attr_name); | |
if (!empty($attr)) { | |
echo 'Attribute: ' . $attr . '<br>'; | |
} | |
} | |
add_action('woocommerce_after_shop_loop_item', 'show_attributes_shop_page'); |
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
/* Sort Woocommerce products by modified date */ | |
function enable_catalog_ordering_by_modified_date($args) { | |
if (isset( $_GET['orderby'])) { | |
if ('modified_date' == $_GET['orderby']) { | |
return array( | |
'orderby' => 'modified', | |
'order' => 'DESC', | |
); | |
} | |
} |