Skip to content

Instantly share code, notes, and snippets.

@corsonr
corsonr / gist:5947181
Last active April 21, 2025 16:57
Show WooCommerce product ID in a custom column on products list page
<?php
/**
* Plugin Name: WooCommerce - Show products IDs
* Plugin URI: http://www.remicorson.com/easily-find-woocommerce-products-id/
* Description: Adds a new columns to products list page to display product IDs
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
@corsonr
corsonr / gist:9152652
Last active February 26, 2025 17:34
WooCommerce : add custom fields to product variations
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 );
/**
@corsonr
corsonr / functions.php
Created September 28, 2016 08:33
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
@corsonr
corsonr / gist:5975207
Last active October 9, 2024 00:33
Show WooCommerce order ID in a custom column on orders list page
<?php
/**
* Plugin Name: WooCommerce - Show order IDs
* Plugin URI: http://www.remicorson.com/easily-find-woocommerce-order-id/
* Description: Adds a new columns to order list page to display order IDs
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
@corsonr
corsonr / gist:5933479
Created July 5, 2013 10:00
List WooCommerce products by tags
<?php
/**
* Plugin Name: WooCommerce - List Products by Tags
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-tags/
* Description: List WooCommerce products by tags using a shortcode, ex: [woo_products_by_tags tags="shoes,socks"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
@corsonr
corsonr / more-recent-product.php
Created April 27, 2016 13:22
WooCommerce: display more recent version of a product notice
<?php
// Display Fields
add_action( 'woocommerce_product_options_related', 'woo_add_custom_fields' );
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_fields_save' );
// Display notice on proeuct page
add_action( 'woocommerce_single_product_summary', 'woo_display_more_recent_product_notice', 10 );
Fixe l'issue #
### Description
Expliquer pourquoi ces changements sont importants - quel est le problème, et comment cette PR y remédie.
### Changements dans cette PR
-
-
### Description de l'issue
Description claire et concise du bug ou de la feature.
### Pour répliquer
Etapes pour répliquer:
1. Aller à '...'
2. Cliquer sur '....'
@corsonr
corsonr / gist:7215762
Last active September 25, 2024 14:14
WooCommerce: Hide Checkout Fields For Virtual Products
<?php
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' );
/**
* Remove unwanted checkout fields
*
* @return $fields array
*/
function woo_remove_billing_checkout_fields( $fields ) {
@corsonr
corsonr / gist:81a67e71dca0e9bd18f3
Created March 19, 2015 09:26
WooCommerce: filter shipping packages
add_filter( 'woocommerce_cart_shipping_packages', 'bulky_woocommerce_cart_shipping_packages' );
function bulky_woocommerce_cart_shipping_packages( $packages ) {
// Reset the packages
$packages = array();
// Bulky items
$bulky_items = array();
$regular_items = array();