Skip to content

Instantly share code, notes, and snippets.

@AndrewSepic
Created May 26, 2020 19:49
Show Gist options
  • Save AndrewSepic/578980b89463dc0fdca472ac2e4613f7 to your computer and use it in GitHub Desktop.
Save AndrewSepic/578980b89463dc0fdca472ac2e4613f7 to your computer and use it in GitHub Desktop.
<?php
/**
* mana functioncust and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package mana
*/
if ( ! function_exists( 'mana_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function mana_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on mana, use a find and replace
* to change 'mana' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'mana', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'burlington' => esc_html__( 'Burlington Menu', 'mana' ),
'company-footer' => __( 'Company Footer Menu' ),
'shopping-footer' => __( 'Shopping Footer Menu' )
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'mana_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif; // mana_setup
add_action( 'after_setup_theme', 'mana_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function mana_content_width() {
$GLOBALS['content_width'] = apply_filters( 'mana_content_width', 640 );
}
add_action( 'after_setup_theme', 'mana_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function mana_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'mana' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer', 'mana' ),
'id' => 'footer-widget',
'description' => '',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
) );
}
add_action( 'widgets_init', 'mana_widgets_init' );
/*
* Enqueue Scripts & Styles
*/
require get_template_directory() . '/inc/enqueue-scripts.php';
/*
* Register Images
*/
add_image_size('banner', 1500, 9999, false);
add_image_size('staff', 275, 241, true);
add_image_size('upcoming-event', 275, 188, true);
add_image_size('recipe', 275, 188, true);
add_image_size('recipe-large', 893, 827, true);
add_image_size('user_profile', 78, 78, true);
add_role('department_manager', 'Department Manager');
add_role('saratoga_manager', 'Saratoga Manager');
/**
* Custom post types.
*/ // This Plugin is deprecated. It continues to work but vanilla CPT's are recommended. //
add_action( 'after_setup_theme', 'healthy_setup_post_types' );
function healthy_setup_post_types() {
if ( ! class_exists( 'Super_Custom_Post_Type' ) )
return;
$teams = new Super_Custom_Post_Type( 'team', 'Team Member', 'Team Members' );
$teams->set_icon('user');
$team_categorys = new Super_Custom_Taxonomy( 'team_category', 'Team Category', 'Team Categories' );
connect_types_and_taxes($teams, $team_categorys);
$departments = new Super_Custom_Taxonomy( 'department', 'Department', 'Departments' );
//$locations = new Super_Custom_Post_Type( 'location', 'Store Location', 'Store Locations' );
$open_positions = new Super_Custom_Post_Type( 'open_position', 'Open Position', 'Open Positions' );
}
/**
* Vanilla CPT for new Store locations 5/2020
*/
// Register Custom Post Type
function hl_location_post_type() {
$labels = array(
'name' => _x( 'Store Locations', 'Store Locations', 'store-locations' ),
'singular_name' => _x( 'Store Location', 'Store Location', 'store-location' ),
'menu_name' => __( 'Store Locations', 'text_domain' ),
'name_admin_bar' => __( 'Store Location', 'text_domain' ),
'archives' => __( 'Store Location Archives', 'text_domain' ),
'attributes' => __( 'Store Location Attributes', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Store Locations', 'text_domain' ),
'add_new_item' => __( 'Add New Location', 'text_domain' ),
'add_new' => __( 'Add New Location', 'text_domain' ),
'new_item' => __( 'New Store Location', 'text_domain' ),
'edit_item' => __( 'Edit Store Location', 'text_domain' ),
'update_item' => __( 'Update Store Location', 'text_domain' ),
'view_item' => __( 'View Store Location', 'text_domain' ),
'view_items' => __( 'View Store Location', 'text_domain' ),
'search_items' => __( 'Search Store Locations', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
'featured_image' => __( 'Featured Image', 'text_domain' ),
'set_featured_image' => __( 'Set featured image', 'text_domain' ),
'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
'use_featured_image' => __( 'Use as featured image', 'text_domain' ),
'insert_into_item' => __( 'Insert into item', 'text_domain' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
'items_list' => __( 'Items list', 'text_domain' ),
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
'filter_items_list' => __( 'Filter items list', 'text_domain' ),
);
$args = array(
'label' => __( 'Store Location', 'text_domain' ),
'description' => __( 'Store Locations for Healthy Living.', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'taxonomies' => array( 'news' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-location',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'store_location', $args );
}
add_action( 'init', 'hl_location_post_type', 0 );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Register custom navigation walker.
*/
require get_template_directory() . '/inc/wp_bootstrap_navwalker.php';
/**
* Load Store Location GeoJSON & Cookies
*/
require get_template_directory() . '/inc/store-location-cookies.php';
require get_template_directory() . '/inc/locations.php';
/**
* Load AJAX Search & Filter
*/
require get_template_directory() . '/inc/search.php';
require get_template_directory() . '/inc/filter.php';
/**
* Load AJAX Load More Posts
*/
require get_template_directory() . '/inc/load-more-ajax.php';
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/helpers/template-functions.php';
require get_template_directory() . '/inc/helpers/responsive-images.php';
// for Page-builder
require get_template_directory() . '/inc/helpers/helpers.php';
/**
* Create ACF Options Page
*/
if (function_exists('acf_add_options_page')){
$args = array(
'page_title' => 'Category Options',
'position' => '52.3'
);
acf_add_options_page($args);
$front_page_args = array(
'page_title' => 'Front Page',
'position' => '52.2'
);
acf_add_options_page($front_page_args);
acf_add_options_page('Recipes List');
acf_add_options_page('Events List');
}
add_filter('woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<span class="hl-cart-total"><?php echo WC()->cart->get_cart_total(); ?></span>
<?php
$fragments['span.hl-cart-total'] = ob_get_clean();
return $fragments;
}
add_filter('woocommerce_add_to_cart_fragments', 'woocommerce_header_cart_count_fragment');
function woocommerce_header_cart_count_fragment( $fragments){
global $woocommerce;
ob_start();
?>
<div class="cart-count"><span class="cart-count-span" id="cart-count-span"><?php echo WC()->cart->get_cart_contents_count(); ?></span></div>
<?php
$fragments['.cart-count'] = ob_get_clean();
return $fragments;
}
add_filter('woocommerce_add_to_cart_fragments', 'woocommere_mobile_add_to_cart_fragment');
function woocommere_mobile_add_to_cart_fragment( $fragments ){
global $woocommerce;
$cart_url = wc_get_cart_url();
ob_start();
?>
<a class="hl-cart-mobile-link" href="<?php echo $cart_url; ?>">
<img src="<?php echo get_template_directory_uri(); ?>/img/cart-icon.svg" alt="cart">
My Cart (<?php echo WC()->cart->get_cart_contents_count(); ?>)
</a>
<?php
$fragments['.hl-cart-mobile-link'] = ob_get_clean();
return $fragments;
}
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;
}
function usm_set_related_products() {
global $post;
$isThanksgiving = has_term( 'thanksgiving-2018', 'product_cat', $post );
if(is_product() && !$isThanksgiving) {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
}
}
add_action('template_redirect', 'usm_set_related_products');
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('https://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
//add the quantity field for add to cart shortcode
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( ! is_shop() && ! is_product_taxonomy() ){
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= '<span class="qty-label">Qty </span>';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="add_to_cart_button">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
}
return $html;
}
function healthyliving_load_bootstrap_dropdown(){
?>
<script>
//Bootstrap Select Dropdowns
jQuery('.orderby').selectpicker({
style: 'btn-outline dropdown-hl',
});
</script>
<?php
}
add_action('wp_footer', 'healthyliving_load_bootstrap_dropdown', 100, 2);
function get_team_member() {
$post_id = $_POST['id'];
$args = array(
'post_type' => 'team',
'posts_per_page' => 1,
'post__in' => array( $post_id ),
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ){
$loop->the_post();
$info['staffpic'] = get_the_post_thumbnail();
$info['title'] = get_the_title();
$info['position'] = get_field('position');
$info['content'] = get_the_content();
echo json_encode( $info );
}
wp_reset_postdata();
wp_die();
}
add_action( 'wp_ajax_get_team_member', 'get_team_member' );
add_action( 'wp_ajax_nopriv_get_team_member', 'get_team_member' );
function custom_excerpt_more( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'custom_excerpt_more' );
/* Change Excerpt length */
function custom_excerpt_length( $length ) {
return 35;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function healthyliving_tribe_custom_colors( ){
$terms = get_terms( 'tribe_events_cat' );
if ( $terms ) : ?>
<?php foreach( $terms as $term ) : ?>
<?php
$bgcolor = get_field('category_color', 'tribe_events_cat_' . $term->term_id);
?>
<?php if ( $bgcolor ) : ?>
<style>
.tribe-events-category-<?php echo $term->slug; ?> {
background-color: <?php echo $bgcolor; ?>;
}
.tribe-events-category-<?php echo $term->slug; ?> h3 > a{
color: #FFF;
}
.tribe-events-filter-group .tribe-events-category-<?php echo $term->slug; ?> {
border-right: 5px solid <?php echo $bgcolor; ?>;
}
</style>
<?php else : ?>
<style>
.tribe-events-filter-group .tribe-events-category-<?php echo $term->slug; ?> {
border-right: 5px solid #59916D;
}
</style>
<?php endif; ?>
<?php endforeach; ?>
<?php endif;
}
add_action( 'wp_head', 'healthyliving_tribe_custom_colors' );
// Return products for store location when browsing woocomm.
add_action( 'woocommerce_product_query', 'healthyliving_products_split_by_location' );
function healthyliving_products_split_by_location( $q ){
if ( isset( $_COOKIE['store_id'] ) ){
$location = $_COOKIE['store_id'];
$meta_query = $q->get( 'meta_query' );
$meta_query[] = array(
'key' => 'store_location',
'value' => $location,
'compare' => 'LIKE'
);
echo '<pre>';
print_r($meta_query);
echo '</pre>';
$q->set( 'meta_query', $meta_query );
}
}
function healthyliving_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/hl-logo.png);
width: 100%;
background-size: 255px;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'healthyliving_login_logo' );
/**
* Remove specific category ID's from the WooCommerce Shop page
*/
add_filter( 'get_terms', 'healthyliving_set_subcategory_terms', 10, 3 );
function healthyliving_set_subcategory_terms( $terms, $taxonomies, $args ) {
$hidden_shop_categories = get_field('hidden_shop_categories', 'option');
$new_terms = array();
// if a product category and on the shop page
if ( $taxonomies && in_array( 'product_cat', $taxonomies ) && ! is_admin() && is_shop() ) {
$current_store_id = healthyliving_get_store_id();
$exclusive_to_this_store = array();
foreach ( $terms as $key => $term ) {
$store_id = get_field('store_location', 'product_cat_' . $term->term_id );
if ( $store_id ){
if ( is_array( $store_id ) ){
if ( in_array( $current_store_id, $store_id ) || $current_store_id == $store_id ) {
$exclusive_to_this_store[] = $term->term_id;
}
}
}
}
foreach ( $terms as $key => $term ) {
if ( ! in_array( $term->term_id, $hidden_shop_categories) ) {
if ( in_array( $term->term_id, $exclusive_to_this_store) ){
$new_terms[] = $term;
}
}
}
$terms = $new_terms;
}
return $terms;
}
/**
* Remove specific category ID's from search
*/
function healthyliving_remove_product_cats( $query ) {
$hidden_shop_categories = get_field('hidden_shop_categories', 'option');
// Comment out the line below to hide products in the admin as well
if ( is_admin() ) return;
if ( $query->is_search ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $hidden_shop_categories,
'operator' => 'NOT IN',
)
) );
}
}
add_action( 'pre_get_posts', 'healthyliving_remove_product_cats' );
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_get_catalog_ordering_args', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby($args) {
if (is_product_category( 'heartworks-lunch' )) {
$args['orderby'] = 'date';
$args['order'] = 'ASC';
return $args;
} else {
return $args;
}
}
// Filter Yoast Meta Priority to be below all ACF fields
add_filter( 'wpseo_metabox_prio', function() {
return 'low';
});
add_filter( 'woocommerce_enable_order_notes_field', '__return_false', 1);
function healthyliving_events_redirect(){
// echo $_SERVER['REQUEST_URI'];
// exit();
if ( $_SERVER['REQUEST_URI'] == '/product-category/events/' ){
if ( healthyliving_get_store_location_name() == 'burlington'){
wp_redirect('/events/category/burlington/');
}
else {
wp_redirect('/events/category/saratoga/');
}
}
}
add_action('template_redirect', 'healthyliving_events_redirect');
//add_filter( 'wc_add_to_cart_message_html', 'custom_add_to_cart_message', 10, 2 );
function custom_add_to_cart_message( $message, $products) {
foreach ($products as $key => $value) {
$product_id = $key;
}
$terms = get_the_terms( $product_id, 'product_cat' );
if($terms) {
$return_to = get_term_link( $terms[0], 'product_cat');
$message = $message . sprintf( '<a href="%s" class="button wc-backwards">%s</a>', $return_to, __( 'Continue Shopping', 'woocommerce' ) );
}
return $message;
}
function wc_ninja_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
function hl_old_contact_page_redirect() {
$location = 'vermont';
if($_COOKIE['store_location_name'] == 'saratoga') {
$location = 'saratoga';
}
if(get_the_permalink() == get_site_url(null, 'contact-us')) {
wp_redirect(get_site_url(null, $location . '/contact-us'));
}
}
add_action( 'template_redirect', 'hl_old_contact_page_redirect' );
// filter products to check if they have scheduling enabled
add_filter('woocommerce_is_purchasable', 'hliving_filter_purchasable', 10, 2);
function hliving_filter_purchasable($is_purchasable, $product) {
// get the product's primary category
$terms = get_the_terms( $product->get_id(), 'product_cat' );
$cat = $terms[0];
// check if scheduling is enabled for this category
if(get_field('usm_cat_scheduler_enabled', $cat)) {
// set timezone to NY
date_default_timezone_set('America/New_York');
// get current day of week
$dowMap = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
$dow_numeric = date('w');
$today = $dowMap[$dow_numeric];
// get current time and the availability timeframe
$current = new DateTime();
$current = $current->format('h:i a');
$start = get_field('usm_cat_scheduler_'.$today.'_start', $cat);
$end = get_field('usm_cat_scheduler_'.$today.'_end', $cat);
// if there is no time frame set for this day,
// set product as unavailable
if(!start || !end) {
return false;
}
// format times for comparison
$current = DateTime::createFromFormat('H:i a', $current);
$start = DateTime::createFromFormat('H:i a', $start);
$end = DateTime::createFromFormat('H:i a', $end);
// if we are within the timeframe,
// product is available
if ($current >= $start && $current <= $end) {
return true;
}
// if we are outside of timeframe,
// product is unavailable
return false;
}
// for products not dealing with the scheduler,
// return the $is_purchasable boolean
// to avoid conflicts with other plugins and settings
return $is_purchasable;
}
function themeprefix_custom_price_message( $price ) {
global $post;
$product_id = $post->ID;
$terms = wp_get_post_terms( $product_id, 'product_cat' );
foreach ( $terms as $term ) $categories[] = $term->slug;
if ( in_array( 'thanksgiving-turkeys', $categories )) {
return $price . ' Deposit';
}
if ( in_array( 'hl-cooking-kits', $categories )) {
return '$12 per person';
}
return $price;
}
add_filter( 'woocommerce_get_price_html', 'themeprefix_custom_price_message' );
// remove product count from category listing
add_filter( 'woocommerce_subcategory_count_html', 'woo_remove_category_products_count' );
function woo_remove_category_products_count() {
return;
}
add_action( 'after_setup_theme', 'yourtheme_setup' );
function yourtheme_setup() {
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
function gf_spinner_replace( $image_src, $form ) {
return get_template_directory_uri() . '/img/loader.gif';
}
add_filter( 'gform_ajax_spinner_url', 'gf_spinner_replace', 10, 2 );
function usm_format_gift_card_subtotal( $subtotal, $item, $instance ) {
$product_id = $item->get_product_id();
if($product_id == '850275544') {
$qty = $item->get_quantity();
$subtotal = $item->get_subtotal();
// dd($qty);
$subtotal = wc_price($subtotal / $qty);
}
return $subtotal;
};
// add the filter
add_filter( 'woocommerce_order_formatted_line_subtotal', 'usm_format_gift_card_subtotal', 10, 3 );
// The below commented out for dev..
// if($_GET['prod_fix'] == 'true') {
// $products = [850274355, 850274900, 850274848];
//
// foreach ($products as $product_id) {
// $product = new WC_Product_Variable($product_id);
// $variations = $product->get_available_variations();
// dd($variations);
//
// $args = array(
// 'post_type' => 'product_variation',
// 'post_status' => array( 'private', 'publish' ),
// 'numberposts' => -1,
// 'orderby' => 'menu_order',
// 'order' => 'asc',
// 'post_parent' => $product_id // $post->ID
// );
// $variations = get_posts( $args );
//
// foreach ($variations as $variation) {
// update_post_meta($variation->ID, '_virtual', 'yes');
// }
// }
// }
function is_shop_manager() {
$user = wp_get_current_user();
if ( isset( $user->roles[0] ) && $user->roles[0] == 'shop_manager' ) {
return true; // when user is shop manager
} else {
return false; // when user is not shop manager
}
}
add_action('admin_head', 'hide_wc_refund_button');
function hide_wc_refund_button() {
if(!is_shop_manager()) {
return;
}
?>
<script>
jQuery(function () {
jQuery('.refund-items, a[href="admin.php?page=wc-settings"], a[href="admin.php?page=wc_customer_order_csv_export"], a[href="admin.php?page=advanced-notifications"], a[href="admin.php?page=wc-addons"], #menu-posts-product').hide();
jQuery(document).ajaxComplete(function() {
jQuery('.refund-items').css("display","none");
});
jQuery('.order_actions option[value=send_email_customer_refunded_order]').remove();
if (jQuery('#original_post_status').val()=='wc-refunded') {
jQuery('#s2id_order_status').html('Refunded');
} else {
jQuery('#order_status option[value=wc-refunded]').remove();
}
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment