Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
damiencarbery / wc-show-shipping-method-ids.php
Last active Oct 27, 2022
WooCommerce - Show shipping method IDs - List shipping zones, shipping methods and their IDs for use in custom code. https://www.damiencarbery.com/2022/10/show-shipping-method-ids-in-woocommerce/
View wc-show-shipping-method-ids.php
<?php
/*
Plugin Name: WooCommerce - Show shipping method IDs
Plugin URI: https://www.damiencarbery.com/2022/10/show-shipping-method-ids-in-woocommerce/
Description: List shipping zones, shipping methods and their IDs for use in custom code.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / wc-add-shipping-classes-column.php
Last active Oct 24, 2022
Add Shipping Classes column to Products admin page - Add a new column to the WooCommerce Products admin page. https://www.damiencarbery.com/2022/10/add-shipping-classes-column-to-products-admin-page/
View wc-add-shipping-classes-column.php
<?php
/*
Plugin Name: WooCommerce Shipping Classes column to Products listing
Plugin URI: https://www.damiencarbery.com/2022/10/add-shipping-classes-column-to-products-admin-page/
Description: Add a Shipping Class column to the WooCommerce Products listing pages. Requested in WooCommerce Community Facebook group: https://www.facebook.com/groups/advanced.woocommerce/posts/6186336834714017/. Inspired by https://www.conicsolutions.net/tutorials/woocommerce-how-to-add-custom-columns-on-the-products-list-in-dashboard/
Author: Damien Carbery
Version: 0.2
*/
@damiencarbery
damiencarbery / em-attendees-shortcode.php
Last active Oct 20, 2022
Events Manager - List event attendees shortcode
View em-attendees-shortcode.php
<?php
/*
Plugin Name: Events Manager - List event attendees shortcode
Plugin URI: https://www.damiencarbery.com/
Description: Experiment with listing the attendees of an Events Manager event.
Author: Damien Carbery
Version: 0.1
*/
add_shortcode( 'event_attendees', 'dcwd_event_attendees' );
@damiencarbery
damiencarbery / wc-add-shipping-classes-column.php
Created Oct 17, 2022
WooCommerce Shipping Classes column to Products listing - Add a Shipping Classes column to the WooCommerce Products listing pages.
View wc-add-shipping-classes-column.php
<?php
/*
Plugin Name: WooCommerce Shipping Classes column to Products listing
Plugin URI: https://www.damiencarbery.com/
Description: Add a Shipping Classes column to the WooCommerce Products listing pages. Requested in WooCommerce Community Facebook group: https://www.facebook.com/groups/advanced.woocommerce/posts/6186336834714017/. Inspired by https://www.conicsolutions.net/tutorials/woocommerce-how-to-add-custom-columns-on-the-products-list-in-dashboard/
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / conditional-debug-code.php
Last active Oct 14, 2022
Debugging with WordPress - enable WP_DEBUG, with sample usage to investigate wc_get_template()
View conditional-debug-code.php
<?php
// Only call error_log() when in debug mode.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log('WP_DEBUG is enabled');
}
@damiencarbery
damiencarbery / flatsome-out-of-stock-to-sold.php
Last active Oct 4, 2022
Change Flatsome theme 'Out of Stock' label to 'Sold' - Change the 'Out of stock' banner in Flatsome theme to 'Sold'. https://www.damiencarbery.com/2020/06/change-flatsome-theme-out-of-stock-label-to-sold/
View flatsome-out-of-stock-to-sold.php
<?php
/*
Plugin Name: Change Flatsome theme 'Out of Stock' label to 'Sold'
Plugin URI: https://www.damiencarbery.com/2020/06/change-flatsome-theme-out-of-stock-label-to-sold/
Description: Change the 'Out of stock' banner in Flatsome theme to 'Sold'. Also works when [ux_products] shortcode is used.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.3
*/
@damiencarbery
damiencarbery / gp-elements-filter-by-date-range.php
Created Oct 4, 2022
Show GP Premium Elements by date range - Add CMB2 metabox to show a GP Premium Element in a chosen date range.
View gp-elements-filter-by-date-range.php
<?php
/*
Plugin Name: Show GP Premium Elements by date range
Plugin URI: https://www.damiencarbery.com/2022/10/show-gp-premium-elements-by-date-range/
Description: Add CMB2 metabox to show a GP Premium Element in a chosen date range.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / hide-shipping-method-id-category.php
Last active Sep 30, 2022
Hide shipping method by product id or category - Exclude a shipping method if the cart contains certain products or product categories. https://www.damiencarbery.com/2022/10/hide-shipping-method-by-product-id-or-category
View hide-shipping-method-id-category.php
<?php
/*
Plugin Name: Hide shipping method by product id or category
Plugin URI: https://www.damiencarbery.com/2022/10/hide-shipping-method-by-product-id-or-category
Description: Exclude a shipping method if the cart contains certain products or product categories.
Author: Damien Carbery
Version: 0.1
*/
// Filter shipping methods in the checkout - do not show An Post if a Craft item is in the cart.
@damiencarbery
damiencarbery / wc-virtual-coupons.php
Last active Sep 27, 2022
Create WooCommerce coupons programmatically - a proof of concept - Experiment creating virtual coupons for WooCommerce. This is a proof of concept that will be developed to verify a coupon code with an external source. https://www.damiencarbery.com/2018/10/create-woocommerce-coupons-programmatically-a-proof-of-concept/
View wc-virtual-coupons.php
<?php
/*
Plugin Name: Virtual Coupons for WooCommerce
Plugin URI: https://www.damiencarbery.com/2018/10/create-woocommerce-coupons-programmatically-a-proof-of-concept/
Description: Experiment with a virtual coupon, based on a conversation with Mark Davenport.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.2
*/
@damiencarbery
damiencarbery / recovery-mode-email.php
Last active Sep 26, 2022
Set recovery mode email address - Change the recovery mode email address to which the fatal error emails are sent to, instead of bothering and potentially confusing the site admin. https://www.damiencarbery.com/2020/08/set-recovery-mode-email-address/
View recovery-mode-email.php
<?php
/*
Plugin Name: Change Recovery Mode Email
Plugin URI: https://www.damiencarbery.com/2020/08/set-recovery-mode-email-address/
Description: Set the recovery mode email address to which the fatal error emails are sent to, instead of bothering and potentially confusing the site admin. From: https://developer.wordpress.org/reference/hooks/recovery_mode_email/#comment-3265
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version 0.1
*/