Register Custom AutomateWoo Action “Customer – Add to Blacklist Manager Whitelist Table”

if ( ! defined( ‘ABSPATH’ ) ) { exit; } add_filter( ‘automatewoo/actions’, ‘rd_aw_register_customer_add_to_blacklist_manager_whitelist_action’ ); function rd_aw_register_customer_add_to_blacklist_manager_whitelist_action( $actions ) { if ( ! class_exists( ‘\AutomateWoo\Action’ ) ) { return $actions; } if ( ! class_exists( ‘RD_AW_Action_Customer_Add_To_Blacklist_Manager_Whitelist’ ) ) { class RD_AW_Action_Customer_Add_To_Blacklist_Manager_Whitelist…Continue reading

Register Custom AutomateWoo Rule “Customer – Klaviyo Tags”

add_filter( ‘automatewoo/rules/includes’, ‘rd_aw_register_customer_klaviyo_tags_rule’ ); /** * Register custom AutomateWoo customer rules. * * @param array $rules AutomateWoo rules. * @return array */ function rd_aw_register_customer_klaviyo_tags_rule( $rules ) { if ( ! class_exists( ‘\AutomateWoo\Rules\Rule’ ) ) { return $rules; } if (…Continue reading

Register Custom AutomateWoo Rule “Order – Is Customer’s Most Recent”

add_filter( ‘automatewoo/rules/includes’, ‘rd_aw_register_order_is_customers_most_recent_rule’ ); /** * Register custom AutomateWoo rules. * * @param array $rules AutomateWoo rules. * @return array */ function rd_aw_register_order_is_customers_most_recent_rule( $rules ) { if ( ! class_exists( ‘\AutomateWoo\Rules\Abstract_Bool’ ) || ! function_exists( ‘wc_get_orders’ ) ) { return…Continue reading

Add AutomateWoo “Delete Custom Field” Actions

function rd_aw_register_delete_custom_field_actions() { if ( ! class_exists( ‘\AutomateWoo\Action’ ) ) { return; } if ( ! class_exists( ‘RD_AW_Action_Delete_Custom_Field_Base’, false ) ) { abstract class RD_AW_Action_Delete_Custom_Field_Base extends \AutomateWoo\Action { public function load_fields() { $meta_key = ( new \AutomateWoo\Fields\Text() ) ->set_name( ‘meta_key’…Continue reading

Improve WooCommerce Admin Order Refund Button Logic

function rd_refund_button_has_transaction_id( $order ) { return $order instanceof WC_Order && ” !== trim( (string) $order->get_transaction_id() ); } function rd_refund_button_should_be_hidden( $order ) { return $order instanceof WC_Order && ! rd_refund_button_has_transaction_id( $order ) && $order->has_status( array( ‘new’, ‘auto-draft’, ‘draft’, ‘checkout-draft’, ‘pending’, ‘failed’,…Continue reading

Smart Coupons: Admin Voucher References, Notes & Search

function rd_add_generated_gift_coupon_order_note( $generated_coupon ) { if ( ! is_array( $generated_coupon ) || empty( $generated_coupon[‘new_coupon_id’] ) ) { return; } $coupon = new WC_Coupon( absint( $generated_coupon[‘new_coupon_id’] ) ); if ( ! $coupon->get_id() ) { return; } $order_id = absint( $coupon->get_meta( ‘generated_from_order_id’,…Continue reading

[TEMP] Hide YoOhw Split Order Button

function rd_hide_yoohw_split_order_button() { if ( ! class_exists( ‘WooCommerce_Order_Splitter_Edit_Order_Split_Button’ ) ) { return; } $screen = get_current_screen(); if ( ! $screen ) { return; } $is_legacy_order_edit = ‘shop_order’ === $screen->id; $is_hpos_order_edit = ( function_exists( ‘wc_get_page_screen_id’ ) && wc_get_page_screen_id( ‘shop-order’ ) ===…Continue reading