Skip to content

Instantly share code, notes, and snippets.

@Ruzgfpegk
Ruzgfpegk / wp-perf.md
Last active April 9, 2025 09:04
WordPress Performance & Development tips
@damiencarbery
damiencarbery / add-an-post-tracking-provider.php
Last active October 9, 2024 00:29
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
@deeman
deeman / robots.txt
Last active February 4, 2020 10:29
Custom WordpPress/WooCommerce Robots.txt
User-agent: *
Disallow: /wp-admin/
Disallow: /?s=
Disallow: /search/
Allow: /admin/admin-ajax.php
Disallow: /cgi-bin/
Disallow: /wp-content/cache/
Disallow: /trackback/
Disallow: */trackback/
@or128
or128 / class-wc-structured-data.php
Last active February 7, 2020 13:46
Fixed Product Review Schema in WooCommerce (tested in v3.8)
<?php
/**
* Structured data's handler and generator using JSON-LD format.
*
* @package WooCommerce/Classes
* @since 3.0.0
* @version 3.0.0
*/
defined( 'ABSPATH' ) || exit;
function holiday_message_before_header() {
?>
<div class="header-block">
<?php echo do_shortcode( '[block id="YOUR BLOCK NAME"]' ); ?>
</div>
<?php
}
add_action( 'flatsome_before_header', 'holiday_message_before_header', 1 );
@damiencarbery
damiencarbery / woocommerce-stock-info.php
Created October 13, 2019 22:20
List stock levels in WooCommerce - List the stock level for each product and variation. https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/
<?php
/*
Plugin Name: WooCommerce Stock Info
Plugin URI: https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/
Description: List the stock level for each product and variation.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@KoolPal
KoolPal / gist:ba0dce676b522fd8a202c70de0956ff6
Created October 1, 2019 05:51
Retain Quote Billing & Shipping Country ELSE assign Location based on IP (Geolocation)
// 06-05-2019 Retain Quote Billing & Shipping Country ELSE assign Location based on IP (Geolocation)
function remove_checkout_optional_fields_label_script() {
// Only on checkout page
if( ! ( is_checkout() && ! is_wc_endpoint_url() ) ) return;
$optional = '&nbsp;<span class="optional">(' . esc_html__( 'optional', 'woocommerce' ) . ')</span>';
?>
<script>
jQuery(function($){
// On "update" checkout form event remove option to select countries
$(document.body).on('update_checkout', function(){
@damiencarbery
damiencarbery / inject-ad-content.php
Last active February 22, 2020 05:17
Inject Adverts into Posts and Pages - Inject a specified page or widget area into post or page content. https://www.damiencarbery.com/2019/09/inject-adverts-into-posts-and-pages/
<?php
/*
Plugin Name: Inject Adverts into Posts and Pages
Plugin URI: https://www.damiencarbery.com/2019/09/inject-adverts-into-posts-and-pages/
Description: Inject a specified page or widget area into post or page content.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@pitabas106
pitabas106 / zeta-woo-change-quantity.php
Last active February 16, 2022 06:33
WooCommerce: Customers can change the quantity & delete it on checkout page.
<?php
/**
* WooCommerce: Customers can change the quantity & delete it on checkout page.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}