This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add custom column headers | |
function wc_csv_export_modify_column_headers( $column_headers ) { | |
$new_headers = array( | |
'lll_group' => 'LLL Group', | |
'registrant_type' => 'Registrant Type', | |
'partner_spouse' => 'Partner/Spouse', | |
// add other column headers here in the format column_key => Column Name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// rename the "Have a Coupon?" message on the checkout page | |
function woocommerce_rename_coupon_message_on_checkout() { | |
return 'Have a Promo Code?' . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>'; | |
} | |
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' ); | |
// rename the coupon field on the checkout page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// rename the coupon field on the cart page | |
function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) { | |
// bail if not modifying frontend woocommerce text | |
if ( is_admin() || 'woocommerce' !== $text_domain ) { | |
return $translated_text; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hide coupon field on cart page | |
function hide_coupon_field_on_cart( $enabled ) { | |
if ( is_cart() ) { | |
$enabled = false; | |
} | |
return $enabled; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hide coupon form everywhere | |
function hide_coupon_field( $enabled ) { | |
if ( is_cart() || is_checkout() ) { | |
$enabled = false; | |
} | |
return $enabled; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$order = new WC_Order( $order_id ); | |
foreach ( $order->get_items() as $item_key => $item ) { | |
$product = $order->get_product_from_item( $item ); | |
$sku = $product->get_sku(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Automatically update the order status to "completed" for cheque orders | |
function skyverge_auto_complete_on_hold_order( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
if ( 'on-hold' === $order->status ) | |
$order->update_status( 'completed' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wc_customer_order_xml_export_suite_order_export_line_item_format', function( $line_item_format, $order, $item ) { | |
// remove imploded meta | |
unset( $line_item_format['Meta'] ); | |
// add custom meta | |
$line_item_format['YourFullName'] = woocommerce_get_order_item_meta( $item['id'], 'your_full_name', true ); | |
return $line_item_format; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wc_customer_order_xml_export_suite_order_export_order_list_format', function ( $order_format, $order ) { | |
$order_format['AddressCapabilities'] = array( | |
'AddressCapability' => array( | |
0 => array( | |
'@attributes' => array( 'AddressType' => 'MAIN' ), | |
), | |
1 => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_custom_fields_to_xml( $order_data, $order ) { | |
$order_data['BillingCompanyID'] = ( isset( $order->order_custom_fields['billing_company_id'][0] ) ) ? $order->order_custom_fields['billing_company_id'][0] : ''; | |
$order_data['BillingCompanyVAT'] = ( isset( $order->order_custom_fields['billing_company_vat'][0] ) ) ? $order->order_custom_fields['billing_company_vat'][0] : ''; | |
return $order_data; | |
} | |
add_filter( 'wc_customer_order_xml_export_suite_order_export_order_list_format', 'add_custom_fields_to_xml', 10, 2 ); |