Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
damiencarbery / wc-add-custom-product-note-to-details-table.php
Created May 24, 2024 15:15
Add extra product info to WooCommerce details table - Use a custom metabox for extra product information that will be added to the details table. https://www.damiencarbery.com/2024/05/add-extra-product-info-to-woocommerce-details-table/
<?php
/*
Plugin Name: WooCommerce - Add extra product info to details table
Plugin URI: https://www.damiencarbery.com/2024/05/add-extra-product-info-to-woocommerce-details-table/
Description: Use a custom metabox for extra product information that will be added to the details table.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1.20240524
WC tested to: 8.9.1
Requires Plugins: woocommerce
@damiencarbery
damiencarbery / wc-add-custom-order-note-to-details-table.php
Created May 22, 2024 17:37
Add extra order info to WooCommerce details table - Use a custom metabox for extra order information that will be added to the end of the details table. https://www.damiencarbery.com/2024/05/add-extra-order-info-to-woocommerce-details-table/
<?php
/*
Plugin Name: WooCommerce - Add extra order info to details table
Plugin URI: https://www.damiencarbery.com/2024/05/add-extra-order-info-to-woocommerce-details-table/
Description: Use a custom metabox for extra order information that will be added to the end of the details table.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1.20240521
WC tested to: 8.9.1
Requires Plugins: woocommerce
@damiencarbery
damiencarbery / wc-products-shortcode-ids-order.php
Last active May 19, 2024 03:18
Change WooCommerce [products] shortcode display order - Change the order of products in [products] shortcode to order in ids parameter if 'orderby' is set to 'ids'. https://www.damiencarbery.com/2024/05/change-woocommerce-products-shortcode-display-order/
<?php
/*
Plugin Name: WooCommerce - Change [products] shortcode display order
Plugin URI: https://www.damiencarbery.com/
Description: Change the order of products in [products] shortcode to order in ids parameter if 'orderby' is set to 'ids'. Example: [products ids="1,5,2,4" orderby="ids"]
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1.20240517
*/
@damiencarbery
damiencarbery / monochrome-pro-remove-hero-avatar.php
Last active May 2, 2024 10:58
Remove the hero image and avatar from single posts in Monochrome Pro theme.
<?php
/*
Plugin Name: Monochrome Pro - remove hero and avatar
Plugin URI: https://www.facebook.com/groups/genesiswp/posts/8077692698948523/
Description: Remove the hero image and avatar from single posts in Monochrome Pro theme.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / tabs.php
Created April 17, 2024 15:20
Change WooCommerce product tabs to accordion - Modify tabs.php template to use the <details> element for accordion like behaviour for product information. https://www.damiencarbery.com/2024/04/change-woocommerce-product-tabs-to-accordion/
<?php
/**
* Single Product tabs
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/tabs/tabs.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@damiencarbery
damiencarbery / wc-export-order-csv.php
Last active April 5, 2024 16:10
A quick proof of concept of using an order ID to generate a CSV of order details.
<?php
/*
Plugin Name: WooCommerce - Export order details as CSV
Plugin URI: https://www.damiencarbery.com/
Description: Allow exporting the details .
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@damiencarbery
damiencarbery / view-order-on-front-end.php
Last active May 20, 2024 13:44
View WooCommerce order on front end - Use an encrypted link to allow a customer view order details on the front end. https://www.damiencarbery.com/2024/01/view-woocommerce-order-on-front-end/
<?php
/*
Plugin Name: View WooCommerce order on front end
Plugin URI: https://www.damiencarbery.com/2024/01/view-woocommerce-order-on-front-end/
Description: Use an encrypted link to allow a customer view order details on the front end.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.2.1
WC tested to: 8.5.1
*/
@damiencarbery
damiencarbery / add-class-on-ninja-forms-dropdowns.js
Last active January 9, 2024 10:23
Ninja Forms - add class to listselect element as element rendered
// This code attempts to add a .with-border class to dropdowns as they are rendered.
// Create a new object for custom validation of a custom field.
var dcwdCustomFieldController = Marionette.Object.extend( {
initialize: function() {
console.log( 'In initialize of new code 1154' );
// From: https://developer.ninjaforms.com/codex/field-view-rendering/
this.listenTo( nfRadio.channel( 'listselect' ), 'render:view', this.renderView );
},
@damiencarbery
damiencarbery / hide-non-free-shipping-rates.php
Created January 1, 2024 13:43
Hide shipping rates if free shipping available - Hide non-free shipping rates if zero cost shipping rates are available. https://www.damiencarbery.com/2024/01/hide-shipping-rates-if-free-shipping-available/
<?php
/*
Plugin Name: Hide shipping rates if free shipping available
Plugin URI: https://www.damiencarbery.com/2024/01/hide-shipping-rates-if-free-shipping-available/
Description: Hide non-free shipping rates if zero cost shipping rates are available.
Author: Damien Carbery
Version: 0.1
WC tested up to: 8.4.0
*/
@damiencarbery
damiencarbery / cf7-form.txt
Last active December 29, 2023 22:05
Use Select2 for Contact Form 7 dropdowns - When a Contact Form 7 form has a dropdown, enable Select2 so that the elements are searchable. https://www.damiencarbery.com/2023/12/use-select2-for-contact-form-7-dropdowns/
<p>Experiment with <a href="https://contactform7.com/2023/06/20/setting-upper-limit-of-checkbox-selection/">Schema-Woven Validation</a> and limiting the number of checkboxes that can be clicked.</p>
<label> Your name
[text* your-name] </label>
<label> Your email
[email* your-email] </label>
[select your-country class:enable-select2 "China" "India" "San Marino" "Adélie penguin" "Emperor penguin" "Gentoo penguin" "Little penguin" "Humboldt penguin" "Southern rockhopper penguin" "Galapagos penguin"]