Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Plugin Name: WooCommerce Analytics - Custom Report Columns
* Description: This plugin adds a custom columns to the WooCommerce Analytics customer report csv export.
* Author: Saif Hassan
* Author URI: https://saif-hassan.com
* Version: 1.0.0
*/
add_filter( 'woocommerce_product_get_stock_status', 'my_plugin_set_stock_status', 10, 2 );
add_filter( 'woocommerce_product_variation_get_stock_status', 'my_plugin_set_stock_status', 10, 2 );
/**
* Set maximum back orders.
*
* @param $stock_status string product stock status.
* @param $product integer product.
*
* @return mixed|string
@isaumya
isaumya / remove-woocommerce-bloat-marketing-hub.md
Last active April 30, 2024 12:26
Easily Remove WooCommerce Bloated Features like Marketing Hub from WordPress Admin Menu

Remove WooCommerce Bloated Features from WP Admin Menu

Recently WooCommerce has added a lot of improvements to the plugin which we really appriciate but at the same time a lot of bloated features has alos been added to the plugin like Marketing Hub, a completely useless menu taking extra space among the other important menu items. Now if you find Marketing Hub to be useful, you can keep it.

But just in case you are looking for a way to remove these features that you no longer need from your WordPress Admin menus, take a look at the following code snippets. Please note: though I will show you how you can remove the Marketing Hub from your WP Admin menu list completely and make sure WooCommerce doesn't execute codes for that feature you don't need, you can do the same for other WooCommerce features as well like Analytics.

How to remove Marketing Hub for WooCommerce <= v4.2

If you are using WooCommerce <= v4.2, you can simple add this one line of code in your theme's functions.php f

@pablo-sg-pacheco
pablo-sg-pacheco / functions.php
Created June 8, 2020 17:29
Booster for WooCommerce - Get info from Prices and Currencies by Country Module Options
<?php
add_action('wp_footer',function(){
if ( !WCJ()->modules['price_by_country']->is_enabled() ) {
return;
}
$country = WCJ()->modules['price_by_country']->core->get_customer_country_by_ip();
$group = WCJ()->modules['price_by_country']->core->get_customer_country_group_id();
$the_result = array('country'=>$country,'group'=>$group);
?>
<script>
@helgatheviking
helgatheviking / class-wc-kia-class-email.php
Last active August 6, 2024 03:08
Send a WooCommerce Customer email from the Order Admin Actions
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'WC_KIA_Class_Email', false ) ) :
/**
* A custom Order WooCommerce Email class
*
* @since 0.1
* @extends \WC_Email
<?php
if ( ! function_exists( 'de_woo_email_social_icons' ) ) {
function de_woo_email_social_icons( $icons ) {
echo '<ul class="de-social-icons">
<li><a href="#" target="_blank"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
<li><a href="#" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
<li><a href="#" target="_blank"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
<li><a href="#" target="_blank"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
</ul>
@joshuatf
joshuatf / disable-woocommerce-admin.php
Created March 11, 2020 09:44
A plugin to disable the new WooCommerce Admin package in WooCommerce
<?php
/**
* Plugin Name: Disable WooCommerce Admin
* Description: This plugin disables the new WooCommerce Admin package in WooCommerce.
* Version: 1.0
*/
add_filter( 'woocommerce_admin_disabled', '__return_true' );
@Ruzgfpegk
Ruzgfpegk / wp-perf.md
Last active August 22, 2024 20:53
WordPress Performance & Development tips
@damiencarbery
damiencarbery / add-an-post-tracking-provider.php
Last active August 24, 2024 20:24
Tracking Info to WooCommerce order - Use CMB2 to add a custom metabox to add tracking information to WooCommerce orders. The information is then added to the "Completed Order" email. https://www.damiencarbery.com/2020/01/add-tracking-info-to-woocommerce-order/
<?php
/*
Plugin Name: Add Tracking Provider
Plugin URI: https://www.damiencarbery.com/
Description: Add new An Post (Irish postal service) as a tracking provider.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1.20240414
*/
@helgatheviking
helgatheviking / wc-minimalize-checkout.php
Created December 12, 2019 15:12
Reduce WooCommerce checkout to the bare minimum
<?php
/**
* Plugin Name: WC Minimalize Checkout Settings
* Plugin URI: https://woocommerce.com/
* Description: Reduce checkout to the bare minimum.
* Version: 1.0.0
* Author: Kathy Darling
* Author URI: http://kathyisawesome.com/*
* Requires at least: 5.3.0
* Tested up to: 5.3.0