Skip to content

Instantly share code, notes, and snippets.

View tamarazuk's full-sized avatar
👩‍💻

Tamara Zuk tamarazuk

👩‍💻
View GitHub Profile
@tamarazuk
tamarazuk / wc-gateway-mollie-reorder-gatweays.php
Last active August 29, 2015 14:10
WooCommerce Mollie Gateway - Reorder Mollie payment options
<?php
function wc_mollie_reorder_gateways( $gateways ) {
$gateway_order = array(
// Rearrange these payment options into the order you wish
'WC_Gateway_Mollie_iDEAL',
'WC_Gateway_Mollie_CreditCard',
'WC_Gateway_Mollie_MisterCash',
@tamarazuk
tamarazuk / wc-address-validation-move-postcode-lookup.php
Created November 20, 2014 22:57
WooCommerce Address Validation: Move postcode lookup fields to the top of billing and shipping fields rather than keeping them below the country field.
<?php
function wc_address_validation_move_postcode_lookup() {
wc_enqueue_js( '
( function() {
var $billingLookup = $( "#wc_address_validation_postcode_lookup_billing" );
var $shippingLookup = $( "#wc_address_validation_postcode_lookup_shipping" );
$( "div.woocommerce-billing-fields").find( "h3" ).after( $billingLookup );
@tamarazuk
tamarazuk / wc-nested-category-layout-category-title-remove-parent.php
Last active July 28, 2020 13:31
WooCommerce Nested Category Layout - Remove parent category name from category title
<?php
add_filter( 'wc_nested_category_layout_category_title_html', 'wc_nested_category_layout_category_title_html', 10, 3 );
function wc_nested_category_layout_category_title_html( $title, $categories, $term ) {
$category = $categories[ count( $categories ) - 1 ];
$url = esc_attr( get_term_link( $category ) );
$link = '<a href="' . $url . '">' . wptexturize( $category->name ) . '</a>';
return sprintf( '<h2 class="wc-nested-category-layout-category-title">%s</h2>', $link );
@tamarazuk
tamarazuk / woocommerce-csv-export-separate-item-meta.php
Last active August 31, 2018 04:42
Customer/Order CSV Export: Separate item meta into multiple columns in the Default – One Row per Item format
<?php // only copy this line if needed
/**
* The use of this snippet requires at least WooCommerce 3.2
*/
/**
* Alter the column headers for the orders CSV to split item_meta into separate columns
*
* Note that this change is only applied to the Default - One Row per Item format
<?php
// rename a column
function wc_csv_export_rename_column( $column_headers ) {
// rename the order_notes column to notes
// make sure to not change the key (`order_notes`) in this case
// as this matches the column to the relevant data
// simply change the value of the array to change the column header that's exported
$column_headers['order_notes'] = 'Notes';
<?php
/**
* This adds the new unit to the WooCommerce admin
*/
function add_woocommerce_dimension_unit_league( $settings ) {
foreach ( $settings as &$setting ) {
if ( 'woocommerce_dimension_unit' == $setting['id'] ) {
<?php
// add custom column headers
function wc_csv_export_modify_column_headers( $column_headers ) {
$new_headers = array(
'column_1' => 'Column 1',
'column_2' => 'Column 2',
// add other column headers here in the format column_key => Column Name
);
@tamarazuk
tamarazuk / sv-wc-checkout-add-ons-move.php
Last active March 2, 2016 06:23
Move Checkout Add-ons
<?php
// Reposition Checkout Addons to under Order Notes
function sv_wc_checkout_addons_change_position() {
return 'woocommerce_after_order_notes';
}
add_filter( 'wc_checkout_add_ons_position', 'sv_wc_checkout_addons_change_position' );
@tamarazuk
tamarazuk / wc_custom_order_fields_order_csv_export.php
Created August 10, 2014 06:03
WooCommerce Custom Order Fields - Add fields to Order CSV Export.
<?php
/**
* Modify the order export column headers to add Custom Order Fields
*
* @param array $column_headers column headers in column_key => column_name format
* @param \WC_Customer_Order_CSV_Export_Generator the generator instance
* @return array modified column headers
*/
function sv_csv_export_custom_order_fields_order_headers( $column_headers, $generator ) {
@tamarazuk
tamarazuk / woocommerce-customer-order-csv-export-username.php
Created August 6, 2014 06:58
WooCommerce Customer/Order CSV Export : Add username column
<?php
/**
* CSV Customer Export Column Headers.
*
* Filter the column headers for the customer export
*
* @param array $column_headers {
* column headers in key => name format
* }