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
add_action( 'woocommerce_checkout_create_order_line_item', 'custom_checkout_save_category_data_on_the_order', 20, 4 ); | |
function custom_checkout_save_category_data_on_the_order( $item, $cart_item_key, $values, $order ) { | |
if ( $item->is_type( 'line_item' ) ) { | |
// Get the product categories for this item | |
$terms = wp_get_post_terms( $item->get_product_id(), 'product_cat', array( 'fields' => 'names' ) ); | |
// Save a coma separated string of product category names in line item meta | |
$item->update_meta_data( 'Categories', implode( ', ', $terms ) ); | |
} |
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
add_action( 'woocommerce_order_actions', 'add_simulate_renewal_subscription_action' ); | |
function add_simulate_renewal_subscription_action( $actions ) { | |
global $theorder; | |
// Make sure we're in a subscription typeof order | |
if ( wcs_is_subscription( $theorder ) && ! $theorder->has_status( wcs_get_subscription_ended_statuses() ) ) { | |
// New action |
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
add_filter ( 'woocommerce_shipping_ups_check_store_currency', '__return_false' ); |
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
add_action( 'woocommerce_email', 'unhook_vendor_emails_on_hold_status' ); | |
function unhook_vendor_emails_on_hold_status( $email_class ) { | |
remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Product_Vendors_Order_Email_To_Vendor'], 'trigger' ) ); | |
remove_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $email_class->emails['WC_Product_Vendors_Order_Email_To_Vendor'], 'trigger' ) ); | |
} |
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
add_filter( 'wc_square_sync_max_objects_to_retrieve', 'custom_reduce_square_batch_size' ); | |
function custom_reduce_square_batch_size( $max ) { | |
return 200; | |
} |
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
add_filter ('woocommerce_json_search_limit', 'woo_set_custom_search_limit', 10 ); | |
function woo_set_custom_search_limit( $limit ) { | |
return 100; | |
} |
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
add_filter( 'wc_points_rewards_my_account_points_events', 'custom_points_and_rewards_events_on_my_account_page' ); | |
function custom_points_and_rewards_events_on_my_account_page( $points, $user ) { | |
return 30; | |
} |
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
add_action( 'woocommerce_before_calculate_totals', 'custom_calculate_shipping_date_based_on_addons' ); | |
function custom_calculate_shipping_date_based_on_addons() { | |
$cart_contents = WC()->cart->cart_contents; | |
foreach ( $cart_contents as $cart_item_key => $cart_item_data ) { | |
if ( ! empty( $cart_item_data['addons'] ) ) { | |
// addons in cart, add your code here | |
} |
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
add_filter( 'woocommerce_email_attachments', 'add_woocommerce_attachments_for_certain_product', 10, 3 ); | |
function add_woocommerce_attachments_for_certain_product ( $attachments, $email_id, $email_order ){ | |
$product_id = 217762; | |
$attachment_id = 217944; | |
if( $email_id === 'customer_processing_order' ){ | |
$order = wc_get_order( $email_order ); | |
$items = $order->get_items(); | |
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
add_action( 'woocommerce_cart_actions', 'custom_remove_paypal_button' ); | |
function custom_remove_paypal_button() { | |
remove_action( 'woocommerce_proceed_to_checkout', array( wc_gateway_ppec()->cart, 'display_paypal_button' ), 20 ); | |
} |
NewerOlder