Plugin Directory

Changeset 2678577


Ignore:
Timestamp:
02/14/2022 03:39:02 PM (4 years ago)
Author:
convertkit
Message:

Update to version 1.4.3 from GitHub

Location:
convertkit-for-woocommerce
Files:
22 added
4 deleted
26 edited
1 copied

Legend:

Unmodified
Added
Removed
  • convertkit-for-woocommerce/tags/1.4.3/admin/class-ckwc-admin-product.php

    r2668107 r2678577  
    3535        $this->integration = WP_CKWC_Integration();
    3636
     37        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     38        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
    3739        add_action( 'add_meta_boxes_product', array( $this, 'add_meta_boxes' ) );
    3840        add_action( 'save_post_product', array( $this, 'save_product' ) );
     41
     42    }
     43
     44    /**
     45     * Enqueue Javascript for the WooCommerce Add / Edit Product screen.
     46     *
     47     * @since   1.4.3
     48     */
     49    public function enqueue_scripts() {
     50
     51        // Bail if we're not on the Add / Edit Product screen.
     52        if ( ! $this->is_edit_product_screen() ) {
     53            return;
     54        }
     55
     56        // Enqueue Select2 JS.
     57        ckwc_select2_enqueue_scripts();
     58
     59    }
     60
     61    /**
     62     * Enqueue CSS for the WooCommerce Add / Edit Product screen.
     63     *
     64     * @since   1.4.3
     65     */
     66    public function enqueue_styles() {
     67
     68        // Bail if we're not on the Add / Edit Product screen.
     69        if ( ! $this->is_edit_product_screen() ) {
     70            return;
     71        }
     72
     73        // Enqueue CSS.
     74        wp_enqueue_style( 'ckwc-product', CKWC_PLUGIN_URL . '/resources/backend/css/product.css', false, CKWC_PLUGIN_VERSION );
     75
     76        // Enqueue Select2 CSS.
     77        ckwc_select2_enqueue_styles();
    3978
    4079    }
     
    77116        $subscription = array(
    78117            'id'        => 'ckwc_subscription',
    79             'class'     => 'widefat',
     118            'class'     => 'ckwc-select2 widefat',
    80119            'name'      => 'ckwc_subscription',
    81120            'value'     => get_post_meta( $post->ID, 'ckwc_subscription', true ),
     
    127166    }
    128167
     168    /**
     169     * Checks if the request is for viewing the WooCommerce Add / Edit Product screen.
     170     *
     171     * @since   1.4.3
     172     *
     173     * @return  bool
     174     */
     175    private function is_edit_product_screen() {
     176
     177        // Return false if we cannot reliably determine the current screen that is viewed,
     178        // due to WordPress' get_current_screen() function being unavailable.
     179        if ( ! function_exists( 'get_current_screen' ) ) {
     180            return false;
     181        }
     182
     183        // Get screen.
     184        $screen = get_current_screen();
     185
     186        // Return false if we're not on the Add / Edit Product screen.
     187        if ( $screen->id !== 'product' ) {
     188            return false;
     189        }
     190
     191        return true;
     192
     193    }
     194
    129195}
  • convertkit-for-woocommerce/tags/1.4.3/includes/class-ckwc-integration.php

    r2668107 r2678577  
    1717
    1818    /**
     19     * Holds the Form resources instance.
     20     *
     21     * @since   1.4.3
     22     *
     23     * @var     CKWC_Resource_Forms
     24     */
     25    private $forms;
     26
     27    /**
     28     * Holds the Form resources instance.
     29     *
     30     * @since   1.4.3
     31     *
     32     * @var     CKWC_Resource_Tags
     33     */
     34    private $tags;
     35
     36    /**
     37     * Holds the Form resources instance.
     38     *
     39     * @since   1.4.3
     40     *
     41     * @var     CKWC_Resource_Sequences
     42     */
     43    private $sequences;
     44
     45    /**
     46     * Holds the Form resources instance.
     47     *
     48     * @since   1.4.3
     49     *
     50     * @var     CKWC_Resource_Custom_Fields
     51     */
     52    private $custom_fields;
     53
     54    /**
    1955     * Constructor
    2056     *
     
    3571        if ( is_admin() ) {
    3672            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     73            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
    3774            add_action( "woocommerce_update_options_integration_{$this->id}", array( $this, 'process_admin_options' ) );
    3875            add_filter( "woocommerce_settings_api_sanitized_fields_{$this->id}", array( $this, 'sanitize_settings' ) );
     
    5289        $this->form_fields = array(
    5390            // Enable/Disable entire integration.
    54             'enabled'         => array(
     91            'enabled'                       => array(
    5592                'title'   => __( 'Enable/Disable', 'woocommerce-convertkit' ),
    5693                'type'    => 'checkbox',
     
    6097
    6198            // API Key and Secret.
    62             'api_key'         => array(
     99            'api_key'                       => array(
    63100                'title'       => __( 'API Key', 'woocommerce-convertkit' ),
    64101                'type'        => 'text',
     
    77114                'class'       => 'enabled',
    78115            ),
    79             'api_secret'      => array(
     116            'api_secret'                    => array(
    80117                'title'       => __( 'API Secret', 'woocommerce-convertkit' ),
    81118                'type'        => 'text',
     
    96133
    97134            // Subscribe.
    98             'event'           => array(
     135            'event'                         => array(
    99136                'title'       => __( 'Subscribe Event', 'woocommerce-convertkit' ),
    100137                'type'        => 'select',
     
    111148                'class'       => 'enabled subscribe',
    112149            ),
    113             'subscription'    => array(
     150            'subscription'                  => array(
    114151                'title'       => __( 'Subscription', 'woocommerce-convertkit' ),
    115152                'type'        => 'subscription',
    116153                'default'     => '',
    117                 'description' => __( 'The ConvertKit Form, Tag or Sequence to subscribe Customers to.', 'woocommerce-convertkit' ),
    118 
    119                 // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
    120                 'class'       => 'enabled subscribe',
    121             ),
    122             'name_format'     => array(
     154                'description' => __( 'The ConvertKit form, tag or sequence to subscribe customers to.', 'woocommerce-convertkit' ),
     155
     156                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     157                'class'       => 'enabled subscribe',
     158            ),
     159            'name_format'                   => array(
    123160                'title'       => __( 'Name Format', 'woocommerce-convertkit' ),
    124161                'type'        => 'select',
     
    136173            ),
    137174
     175            // Custom Field Mappings.
     176            'custom_field_phone'            => array(
     177                'title'       => __( 'Send Phone Number', 'woocommerce-convertkit' ),
     178                'type'        => 'custom_field',
     179                'default'     => '',
     180                'description' => __( 'The ConvertKit custom field to store the order\'s phone number.', 'woocommerce-convertkit' ),
     181
     182                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     183                'class'       => 'enabled subscribe',
     184            ),
     185            'custom_field_billing_address'  => array(
     186                'title'       => __( 'Send Billing Address', 'woocommerce-convertkit' ),
     187                'type'        => 'custom_field',
     188                'default'     => '',
     189                'description' => __( 'The ConvertKit custom field to store the order\'s billing address.', 'woocommerce-convertkit' ),
     190
     191                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     192                'class'       => 'enabled subscribe',
     193            ),
     194            'custom_field_shipping_address' => array(
     195                'title'       => __( 'Send Shipping Address', 'woocommerce-convertkit' ),
     196                'type'        => 'custom_field',
     197                'default'     => '',
     198                'description' => __( 'The ConvertKit custom field to store the order\'s shipping address.', 'woocommerce-convertkit' ),
     199
     200                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     201                'class'       => 'enabled subscribe',
     202            ),
     203            'custom_field_payment_method'   => array(
     204                'title'       => __( 'Send Payment Method', 'woocommerce-convertkit' ),
     205                'type'        => 'custom_field',
     206                'default'     => '',
     207                'description' => __( 'The ConvertKit custom field to store the order\'s payment method.', 'woocommerce-convertkit' ),
     208
     209                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     210                'class'       => 'enabled subscribe',
     211            ),
     212            'custom_field_customer_note'    => array(
     213                'title'       => __( 'Send Customer Note', 'woocommerce-convertkit' ),
     214                'type'        => 'custom_field',
     215                'default'     => '',
     216                'description' => __( 'The ConvertKit custom field to store the order\'s customer note.', 'woocommerce-convertkit' ),
     217
     218                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     219                'class'       => 'enabled subscribe',
     220            ),
     221
    138222            // Subscribe: Display Opt In Checkbox Settings.
    139             'display_opt_in'  => array(
     223            'display_opt_in'                => array(
    140224                'title'       => __( 'Opt-In Checkbox', 'woocommerce-convertkit' ),
    141                 'label'       => __( 'Display an Opt-In checkbox on checkout', 'woocommerce-convertkit' ),
     225                'label'       => __( 'Display an opt-in checkbox on checkout', 'woocommerce-convertkit' ),
    142226                'type'        => 'checkbox',
    143227                'default'     => 'no',
    144228                'description' => __(
    145                     'If enabled, customers will <strong>only</strong> be subscribed to the chosen Forms, Tags and Sequences if they check the "Opt-In" checkbox at checkout.<br />
    146                                       If disabled, customers will <strong>always</strong> be subscribed to the chosen Forms, Tags and Sequences at checkout.',
     229                    'If enabled, customers will <strong>only</strong> be subscribed to the chosen forms, tags and sequences if they check the opt-in checkbox at checkout.<br />
     230                                      If disabled, customers will <strong>always</strong> be subscribed to the chosen forms, tags and sequences at checkout.',
    147231                    'woocommerce-convertkit'
    148232                ),
     
    152236                'class'       => 'enabled subscribe',
    153237            ),
    154             'opt_in_label'    => array(
     238            'opt_in_label'                  => array(
    155239                'title'       => __( 'Opt-In Checkbox: Label', 'woocommerce-convertkit' ),
    156240                'type'        => 'text',
    157241                'default'     => __( 'I want to subscribe to the newsletter', 'woocommerce-convertkit' ),
    158                 'description' => __( 'Optional (only used if the above field is checked): Customize the label next to the opt-in checkbox.', 'woocommerce-convertkit' ),
     242                'description' => __( 'Customize the label next to the opt-in checkbox.', 'woocommerce-convertkit' ),
    159243                'desc_tip'    => false,
    160244
     
    162246                'class'       => 'enabled subscribe display_opt_in',
    163247            ),
    164             'opt_in_status'   => array(
     248            'opt_in_status'                 => array(
    165249                'title'       => __( 'Opt-In Checkbox: Default Status', 'woocommerce-convertkit' ),
    166250                'type'        => 'select',
     
    176260                'class'       => 'enabled subscribe display_opt_in',
    177261            ),
    178             'opt_in_location' => array(
     262            'opt_in_location'               => array(
    179263                'title'       => __( 'Opt-In Checkbox: Display Location', 'woocommerce-convertkit' ),
    180264                'type'        => 'select',
    181265                'default'     => 'billing',
    182                 'description' => __( 'Where to display the opt-in checkbox on the checkout page (under Billing Info or Order Info).', 'woocommerce-convertkit' ),
     266                'description' => __( 'Where to display the opt-in checkbox on the checkout page (under "Billing details" or "Additional information").', 'woocommerce-convertkit' ),
    183267                'desc_tip'    => false,
    184268                'options'     => array(
     
    192276
    193277            // Purchase Data.
    194             'send_purchases'  => array(
     278            'send_purchases'                => array(
    195279                'title'       => __( 'Purchase Data', 'woocommerce-convertkit' ),
    196280                'label'       => __( 'Send purchase data to ConvertKit.', 'woocommerce-convertkit' ),
     
    209293
    210294            // Debugging.
    211             'debug'           => array(
     295            'debug'                         => array(
    212296                'title'       => __( 'Debug', 'woocommerce-convertkit' ),
    213297                'type'        => 'checkbox',
    214298                'label'       => __( 'Write data to a log file', 'woocommerce-convertkit' ),
    215299                'description' => sprintf(
    216                     /* translators: %1$s: URL to Log File, %2$s: View Log File text */
     300                    /* translators: %1$s: URL to Log File, %2$s: View log file text */
    217301                    '<a href="%1$s" target="_blank">%2$s</a>',
    218302                    admin_url( 'admin.php?page=wc-status&tab=logs' ),
    219                     __( 'View Log File', 'woocommerce-convertkit' )
     303                    __( 'View log file', 'woocommerce-convertkit' )
    220304                ),
    221305                'default'     => 'no',
     
    235319    public function enqueue_scripts() {
    236320
    237         // Bail if we cannot determine if we are viewing the Integration Settings screen.
    238         if ( ! function_exists( 'get_current_screen' ) ) {
    239             return;
    240         }
    241 
    242         // Get screen.
    243         $screen = get_current_screen();
    244 
    245321        // Bail if we're not on the Integration Settings screen.
    246         if ( $screen->id !== 'woocommerce_page_wc-settings' ) {
     322        if ( ! $this->is_integration_settings_screen() ) {
    247323            return;
    248324        }
     
    250326        // Enqueue JS.
    251327        wp_enqueue_script( 'ckwc-integration', CKWC_PLUGIN_URL . 'resources/backend/js/integration.js', array( 'jquery' ), CKWC_PLUGIN_VERSION, true );
     328
     329        // Enqueue Select2 JS.
     330        ckwc_select2_enqueue_scripts();
     331
     332    }
     333
     334    /**
     335     * Enqueue CSS for the Integration Settings screen.
     336     *
     337     * @since   1.4.3
     338     */
     339    public function enqueue_styles() {
     340
     341        // Bail if we're not on the Integration Settings screen.
     342        if ( ! $this->is_integration_settings_screen() ) {
     343            return;
     344        }
     345
     346        // Enqueue Select2 CSS.
     347        ckwc_select2_enqueue_styles();
    252348
    253349    }
     
    282378        if ( ! $this->is_enabled() ) {
    283379            ob_start();
    284             require_once CKWC_PLUGIN_PATH . '/views/backend/settings/subscription-disabled.php';
     380            require CKWC_PLUGIN_PATH . '/views/backend/settings/subscription-disabled.php';
    285381            return ob_get_clean();
    286382        }
    287383
    288         // Get Forms, Tags and Sequences, refreshing them to fetch the latest data from the API.
    289         $forms = new CKWC_Resource_Forms();
    290         $forms->refresh();
    291         $sequences = new CKWC_Resource_Sequences();
    292         $sequences->refresh();
    293         $tags = new CKWC_Resource_Tags();
    294         $tags->refresh();
     384        // Get Forms, Tags and Sequences, refreshing them to fetch the latest data from the API,
     385        // if we haven't already fetched them.
     386        if ( ! $this->forms ) {
     387            $this->forms = new CKWC_Resource_Forms();
     388            $this->forms->refresh();
     389        }
     390        if ( ! $this->sequences ) {
     391            $this->sequences = new CKWC_Resource_Sequences();
     392            $this->sequences->refresh();
     393        }
     394        if ( ! $this->tags ) {
     395            $this->tags = new CKWC_Resource_Tags();
     396            $this->tags->refresh();
     397        }
    295398
    296399        // Get current subscription setting and other settings to render the subscription dropdown field.
    297400        $subscription = array(
    298401            'id'        => 'woocommerce_ckwc_subscription',
    299             'class'     => 'select ' . $data['class'],
     402            'class'     => 'select ckwc-select2 ' . $data['class'],
    300403            'name'      => $field,
    301404            'value'     => $this->get_option( $key ),
    302             'forms'     => $forms,
    303             'tags'      => $tags,
    304             'sequences' => $sequences,
     405            'forms'     => $this->forms,
     406            'tags'      => $this->tags,
     407            'sequences' => $this->sequences,
    305408        );
    306409
    307410        ob_start();
    308         require_once CKWC_PLUGIN_PATH . '/views/backend/settings/subscription.php';
     411        require CKWC_PLUGIN_PATH . '/views/backend/settings/subscription.php';
     412        return ob_get_clean();
     413
     414    }
     415
     416    /**
     417     * Output HTML for a Custom Field dropdown.
     418     *
     419     * Used when init_form_fields() field type is set to custom_field i.e. used
     420     * for Phone, Billing Address and Shipping Address to Custom Field mapping settings.
     421     *
     422     * @since   1.4.3
     423     *
     424     * @param   string $key    Setting Field Key.
     425     * @param   array  $data   Setting Field Configuration.
     426     */
     427    public function generate_custom_field_html( $key, $data ) {
     428
     429        $field    = $this->get_field_key( $key );
     430        $defaults = array(
     431            'title'             => '',
     432            'disabled'          => false,
     433            'class'             => '',
     434            'css'               => '',
     435            'placeholder'       => '',
     436            'type'              => 'text',
     437            'desc_tip'          => false,
     438            'description'       => '',
     439            'custom_attributes' => array(),
     440            'options'           => array(),
     441        );
     442
     443        $data = wp_parse_args( $data, $defaults );
     444
     445        // If the integration isn't enabled, don't output a selection field.
     446        if ( ! $this->is_enabled() ) {
     447            ob_start();
     448            include CKWC_PLUGIN_PATH . '/views/backend/settings/custom-field-disabled.php';
     449            return ob_get_clean();
     450        }
     451
     452        // Get Custom Fields, refreshing them to fetch the latest data from the API,
     453        // if we haven't already fetched them.
     454        if ( ! $this->custom_fields ) {
     455            $this->custom_fields = new CKWC_Resource_Custom_Fields();
     456            $this->custom_fields->refresh();
     457        }
     458
     459        // Get current custom field setting and other settings to render the custom field dropdown field.
     460        $custom_field = array(
     461            'id'            => $field,
     462            'class'         => 'select ' . $data['class'],
     463            'name'          => $field,
     464            'value'         => $this->get_option( $key ),
     465            'custom_fields' => $this->custom_fields,
     466        );
     467
     468        ob_start();
     469        include CKWC_PLUGIN_PATH . '/views/backend/settings/custom-field.php';
    309470        return ob_get_clean();
    310471
     
    421582
    422583    /**
     584     * Checks if the request is for this integration's settings screen.
     585     *
     586     * @since   1.4.3
     587     *
     588     * @return  bool
     589     */
     590    private function is_integration_settings_screen() {
     591
     592        // Return false if we cannot reliably determine the current screen that is viewed,
     593        // due to WordPress' get_current_screen() function being unavailable.
     594        if ( ! function_exists( 'get_current_screen' ) ) {
     595            return false;
     596        }
     597
     598        // Get screen.
     599        $screen = get_current_screen();
     600
     601        // Return false if we're not on the Integration Settings screen.
     602        if ( $screen->id !== 'woocommerce_page_wc-settings' ) {
     603            return false;
     604        }
     605
     606        return true;
     607
     608    }
     609
     610    /**
    423611     * Deletes all cached Forms, Tags and Sequences from the options table.
    424612     *
     
    436624        $sequences->delete();
    437625
     626        $custom_fields = new CKWC_Resource_Custom_Fields();
     627        $custom_fields->delete();
     628
    438629    }
    439630
  • convertkit-for-woocommerce/tags/1.4.3/includes/class-ckwc-order.php

    r2668107 r2678577  
    5151        }
    5252
    53         // Subscribe customer's email address to a form or tag.
     53        // Subscribe customer's email address to a form, tag or sequence.
    5454        add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'maybe_subscribe_customer' ), 99999, 1 );
    5555        add_action( 'woocommerce_order_status_changed', array( $this, 'maybe_subscribe_customer' ), 99999, 3 );
     
    9797            return;
    9898        }
     99
     100        // If configured in the Integration, map Phone, Billing and/or Shipping Addresses to ConvertKit
     101        // Custom Fields now.
     102        $fields = $this->custom_field_data( $order );
    99103
    100104        // Build an array of Forms, Tags and Sequences to subscribe the Customer to, based on
     
    156160                $this->email( $order ),
    157161                $this->name( $order ),
    158                 $order_id
     162                $order_id,
     163                $fields
    159164            );
    160165        }
     166
     167        // The customer was subscribed to ConvertKit, so request a Plugin review.
     168        // This can safely be called multiple times, as the review request
     169        // class will ensure once a review request is dismissed by the user,
     170        // it is never displayed again.
     171        WP_CKWC()->get_class( 'review_request' )->request_review();
    161172
    162173    }
     
    173184     * @param   string $name           Customer Name.
    174185     * @param   int    $order_id       WooCommerce Order ID.
     186     * @param   mixed  $custom_fields  Custom Fields (false | array).
    175187     * @return  mixed                   WP_Error | array
    176188     */
    177     public function subscribe_customer( $resource_type, $resource_id, $email, $name, $order_id ) {
     189    public function subscribe_customer( $resource_type, $resource_id, $email, $name, $order_id, $custom_fields ) {
    178190
    179191        // Call API to subscribe the email address to the given Form, Tag or Sequence.
    180192        switch ( $resource_type ) {
    181193            case 'form':
    182                 $result = $this->api->form_subscribe( $resource_id, $email, $name );
     194                $result = $this->api->form_subscribe( $resource_id, $email, $name, $custom_fields );
    183195                break;
    184196
    185197            case 'tag':
    186                 $result = $this->api->tag_subscribe( $resource_id, $email );
     198                $result = $this->api->tag_subscribe( $resource_id, $email, $custom_fields );
    187199                break;
    188200
    189201            case 'sequence':
    190202            case 'course':
    191                 $result = $this->api->sequence_subscribe( $resource_id, $email );
     203                $result = $this->api->sequence_subscribe( $resource_id, $email, $custom_fields );
    192204                break;
    193205        }
     
    373385        $order->add_order_note( __( '[ConvertKit] Purchase Data sent successfully', 'woocommerce-convertkit' ) );
    374386
     387        // The customer's purchase data was sent to ConvertKit, so request a Plugin review.
     388        // This can safely be called multiple times, as the review request
     389        // class will ensure once a review request is dismissed by the user,
     390        // it is never displayed again.
     391        WP_CKWC()->get_class( 'review_request' )->request_review();
     392
    375393        // Return.
    376394        return $response;
     
    455473     * Returns the customer's email address for the given WooCommerce Order,
    456474     * immediately before it is sent to ConvertKit when subscribing the Customer
    457      * to a Form or Tag.
     475     * to a Form, Tag or Sequence.
    458476     *
    459477     * @since   1.0.0
     
    470488         * Returns the customer's email address for the given WooCommerce Order,
    471489         * immediately before it is sent to ConvertKit when subscribing the Customer
    472          * to a Form or Tag.
     490         * to a Form, Tag or Sequence.
    473491         *
    474492         * @since   1.0.0
     
    574592     * Returns the customer's last name for the given WooCommerce Order,
    575593     * immediately before it is sent to ConvertKit when subscribing the Customer
    576      * to a Form or Tag.
     594     * to a Form, Tag or Sequence.
    577595     *
    578596     * @since   1.0.0
     
    589607         * Returns the customer's last name for the given WooCommerce Order,
    590608         * immediately before it is sent to ConvertKit when subscribing the Customer
    591          * to a Form or Tag.
     609         * to a Form, Tag or Sequence.
    592610         *
    593611         * @since   1.0.0
     
    603621    }
    604622
     623    /**
     624     * Returns an array of ConvertKit Custom Field Key/Value pairs, with values
     625     * comprising of Order data based, to be sent to ConvertKit when an Order's
     626     * Customer is subscribed via a Form, Tag or Sequence.
     627     *
     628     * Returns false if no Order data should be stored in ConvertKit Custom Fields.
     629     *
     630     * @since   1.4.3
     631     *
     632     * @param   WC_Order|WC_Order_Refund $order  Order.
     633     * @return  mixed                            array | false
     634     */
     635    private function custom_field_data( $order ) {
     636
     637        $fields = array();
     638
     639        if ( $this->integration->get_option( 'custom_field_phone' ) ) {
     640            $fields[ $this->integration->get_option( 'custom_field_phone' ) ] = $order->get_billing_phone();
     641        }
     642        if ( $this->integration->get_option( 'custom_field_billing_address' ) ) {
     643            $fields[ $this->integration->get_option( 'custom_field_billing_address' ) ] = str_replace( '<br/>', ', ', $order->get_formatted_billing_address() );
     644        }
     645        if ( $this->integration->get_option( 'custom_field_shipping_address' ) ) {
     646            $fields[ $this->integration->get_option( 'custom_field_shipping_address' ) ] = str_replace( '<br/>', ', ', $order->get_formatted_shipping_address() );
     647        }
     648        if ( $this->integration->get_option( 'custom_field_payment_method' ) ) {
     649            $fields[ $this->integration->get_option( 'custom_field_payment_method' ) ] = $order->get_payment_method();
     650        }
     651        if ( $this->integration->get_option( 'custom_field_customer_note' ) ) {
     652            $fields[ $this->integration->get_option( 'custom_field_customer_note' ) ] = $order->get_customer_note();
     653        }
     654
     655        /**
     656         * Returns an array of ConvertKit Custom Field Key/Value pairs, with values
     657         * comprising of Order data based, to be sent to ConvertKit when an Order's
     658         * Customer is subscribed via a Form, Tag or Sequence.
     659         *
     660         * Returns false if no Order data should be stored in ConvertKit Custom Fields.
     661         *
     662         * @since   1.4.3
     663         *
     664         * @param   mixed                       $fields     Custom Field Key/Value pairs (false | array).
     665         * @param   WC_Order|WC_Order_Refund    $order      WooCommerce Order.
     666         */
     667        $fields = apply_filters( 'convertkit_for_woocommerce_custom_field_data', $fields, $order );
     668
     669        // If the fields array is empty, no Custom Field mappings exist.
     670        if ( ! count( $fields ) ) {
     671            return false;
     672        }
     673
     674        return $fields;
     675
     676    }
     677
    605678}
  • convertkit-for-woocommerce/tags/1.4.3/includes/class-ckwc-resource.php

    r2668107 r2678577  
    125125                $results = $api->get_tags();
    126126                break;
     127
     128            case 'custom_fields':
     129                $results = $api->get_custom_fields();
     130                break;
    127131        }
    128132
  • convertkit-for-woocommerce/tags/1.4.3/includes/class-wp-ckwc.php

    r2668107 r2678577  
    143143    private function initialize_global() {
    144144
    145         $this->classes['order'] = new CKWC_Order();
     145        $this->classes['order']          = new CKWC_Order();
     146        $this->classes['review_request'] = new CKWC_Review_Request( 'ConvertKit for WooCommerce', 'convertkit-for-woocommerce' );
    146147
    147148        /**
  • convertkit-for-woocommerce/tags/1.4.3/includes/functions.php

    r2668107 r2678577  
    6868
    6969}
     70
     71/**
     72 * Helper method to enqueue Select2 scripts for use within the ConvertKit Plugin.
     73 *
     74 * @since   1.4.3
     75 */
     76function ckwc_select2_enqueue_scripts() {
     77
     78    wp_enqueue_script( 'ckwc-select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js', array( 'jquery' ), CKWC_PLUGIN_VERSION, false );
     79    wp_enqueue_script( 'ckwc-admin-select2', CKWC_PLUGIN_URL . '/resources/backend/js/select2.js', array( 'ckwc-select2' ), CKWC_PLUGIN_VERSION, false );
     80
     81}
     82
     83/**
     84 * Helper method to enqueue Select2 stylesheets for use within the ConvertKit Plugin.
     85 *
     86 * @since   1.4.3
     87 */
     88function ckwc_select2_enqueue_styles() {
     89
     90    wp_enqueue_style( 'ckwc-select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css', false, CKWC_PLUGIN_VERSION );
     91    wp_enqueue_style( 'ckwc-admin-select2', CKWC_PLUGIN_URL . '/resources/backend/css/select2.css', false, CKWC_PLUGIN_VERSION );
     92
     93}
  • convertkit-for-woocommerce/tags/1.4.3/languages/woocommerce-convertkit.pot

    r2668107 r2678577  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: ConvertKit for WooCommerce 1.4.2\n"
     5"Project-Id-Version: ConvertKit for WooCommerce 1.4.3\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/convertkit-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-01-27T19:06:35+00:00\n"
     12"POT-Creation-Date: 2022-02-14T13:41:17+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.5.0\n"
     
    2929
    3030#. Author of the plugin
    31 #: includes/class-ckwc-integration.php:27
     31#: includes/class-ckwc-integration.php:63
    3232msgid "ConvertKit"
    3333msgstr ""
     
    3737msgstr ""
    3838
    39 #: admin/class-ckwc-admin-product.php:50
     39#: admin/class-ckwc-admin-product.php:89
    4040msgid "ConvertKit Integration"
    4141msgstr ""
     
    8080msgstr ""
    8181
    82 #: includes/class-ckwc-integration.php:28
     82#: includes/class-ckwc-integration.php:64
    8383msgid "Enter your ConvertKit settings below to control how WooCommerce integrates with your ConvertKit account."
    8484msgstr ""
    8585
    86 #: includes/class-ckwc-integration.php:55
     86#: includes/class-ckwc-integration.php:92
    8787msgid "Enable/Disable"
    8888msgstr ""
    8989
    90 #: includes/class-ckwc-integration.php:57
     90#: includes/class-ckwc-integration.php:94
    9191msgid "Enable ConvertKit integration"
    9292msgstr ""
    9393
    94 #: includes/class-ckwc-integration.php:63
     94#: includes/class-ckwc-integration.php:100
    9595msgid "API Key"
    9696msgstr ""
    9797
    9898#. translators: %1$s: Link to ConvertKit Account, %2$s: <br>, %3$s Link to ConvertKit Signup
    99 #: includes/class-ckwc-integration.php:69
    100 #: includes/class-ckwc-integration.php:86
     99#: includes/class-ckwc-integration.php:106
     100#: includes/class-ckwc-integration.php:123
    101101msgid "%1$s Required for proper plugin function. %2$s Don't have a ConvertKit account? %3$s"
    102102msgstr ""
    103103
    104 #: includes/class-ckwc-integration.php:70
     104#: includes/class-ckwc-integration.php:107
    105105msgid "Get your ConvertKit API Key."
    106106msgstr ""
    107107
    108 #: includes/class-ckwc-integration.php:72
    109 #: includes/class-ckwc-integration.php:89
     108#: includes/class-ckwc-integration.php:109
     109#: includes/class-ckwc-integration.php:126
    110110msgid "Sign up here."
    111111msgstr ""
    112112
    113 #: includes/class-ckwc-integration.php:80
     113#: includes/class-ckwc-integration.php:117
    114114msgid "API Secret"
    115115msgstr ""
    116116
    117 #: includes/class-ckwc-integration.php:87
     117#: includes/class-ckwc-integration.php:124
    118118msgid "Get your ConvertKit API Secret."
    119119msgstr ""
    120120
    121 #: includes/class-ckwc-integration.php:99
     121#: includes/class-ckwc-integration.php:136
    122122msgid "Subscribe Event"
    123123msgstr ""
    124124
    125 #: includes/class-ckwc-integration.php:102
     125#: includes/class-ckwc-integration.php:139
    126126msgid "When should customers be subscribed?"
    127127msgstr ""
    128128
    129 #: includes/class-ckwc-integration.php:105
     129#: includes/class-ckwc-integration.php:142
    130130msgid "Order Created"
    131131msgstr ""
    132132
    133 #: includes/class-ckwc-integration.php:106
     133#: includes/class-ckwc-integration.php:143
    134134msgid "Order Processing"
    135135msgstr ""
    136136
    137 #: includes/class-ckwc-integration.php:107
     137#: includes/class-ckwc-integration.php:144
    138138msgid "Order Completed"
    139139msgstr ""
    140140
    141 #: includes/class-ckwc-integration.php:114
     141#: includes/class-ckwc-integration.php:151
    142142msgid "Subscription"
    143143msgstr ""
    144144
    145 #: includes/class-ckwc-integration.php:117
    146 msgid "The ConvertKit Form, Tag or Sequence to subscribe Customers to."
    147 msgstr ""
    148 
    149 #: includes/class-ckwc-integration.php:123
     145#: includes/class-ckwc-integration.php:154
     146msgid "The ConvertKit form, tag or sequence to subscribe customers to."
     147msgstr ""
     148
     149#: includes/class-ckwc-integration.php:160
    150150msgid "Name Format"
    151151msgstr ""
    152152
    153 #: includes/class-ckwc-integration.php:126
     153#: includes/class-ckwc-integration.php:163
    154154msgid "How should the customer name be sent to ConvertKit?"
    155155msgstr ""
    156156
    157 #: includes/class-ckwc-integration.php:129
     157#: includes/class-ckwc-integration.php:166
    158158msgid "Billing First Name"
    159159msgstr ""
    160160
    161 #: includes/class-ckwc-integration.php:130
     161#: includes/class-ckwc-integration.php:167
    162162msgid "Billing Last Name"
    163163msgstr ""
    164164
    165 #: includes/class-ckwc-integration.php:131
     165#: includes/class-ckwc-integration.php:168
    166166msgid "Billing First Name + Billing Last Name"
    167167msgstr ""
    168168
    169 #: includes/class-ckwc-integration.php:140
     169#: includes/class-ckwc-integration.php:177
     170msgid "Send Phone Number"
     171msgstr ""
     172
     173#: includes/class-ckwc-integration.php:180
     174msgid "The ConvertKit custom field to store the order's phone number."
     175msgstr ""
     176
     177#: includes/class-ckwc-integration.php:186
     178msgid "Send Billing Address"
     179msgstr ""
     180
     181#: includes/class-ckwc-integration.php:189
     182msgid "The ConvertKit custom field to store the order's billing address."
     183msgstr ""
     184
     185#: includes/class-ckwc-integration.php:195
     186msgid "Send Shipping Address"
     187msgstr ""
     188
     189#: includes/class-ckwc-integration.php:198
     190msgid "The ConvertKit custom field to store the order's shipping address."
     191msgstr ""
     192
     193#: includes/class-ckwc-integration.php:204
     194msgid "Send Payment Method"
     195msgstr ""
     196
     197#: includes/class-ckwc-integration.php:207
     198msgid "The ConvertKit custom field to store the order's payment method."
     199msgstr ""
     200
     201#: includes/class-ckwc-integration.php:213
     202msgid "Send Customer Note"
     203msgstr ""
     204
     205#: includes/class-ckwc-integration.php:216
     206msgid "The ConvertKit custom field to store the order's customer note."
     207msgstr ""
     208
     209#: includes/class-ckwc-integration.php:224
    170210msgid "Opt-In Checkbox"
    171211msgstr ""
    172212
    173 #: includes/class-ckwc-integration.php:141
    174 msgid "Display an Opt-In checkbox on checkout"
    175 msgstr ""
    176 
    177 #: includes/class-ckwc-integration.php:144
     213#: includes/class-ckwc-integration.php:225
     214msgid "Display an opt-in checkbox on checkout"
     215msgstr ""
     216
     217#: includes/class-ckwc-integration.php:228
    178218msgid ""
    179 "If enabled, customers will <strong>only</strong> be subscribed to the chosen Forms, Tags and Sequences if they check the \"Opt-In\" checkbox at checkout.<br />\n"
    180 "\t\t\t\t\t\t\t\t\t  If disabled, customers will <strong>always</strong> be subscribed to the chosen Forms, Tags and Sequences at checkout."
    181 msgstr ""
    182 
    183 #: includes/class-ckwc-integration.php:155
     219"If enabled, customers will <strong>only</strong> be subscribed to the chosen forms, tags and sequences if they check the opt-in checkbox at checkout.<br />\n"
     220"\t\t\t\t\t\t\t\t\t  If disabled, customers will <strong>always</strong> be subscribed to the chosen forms, tags and sequences at checkout."
     221msgstr ""
     222
     223#: includes/class-ckwc-integration.php:239
    184224msgid "Opt-In Checkbox: Label"
    185225msgstr ""
    186226
    187 #: includes/class-ckwc-integration.php:157
     227#: includes/class-ckwc-integration.php:241
    188228msgid "I want to subscribe to the newsletter"
    189229msgstr ""
    190230
    191 #: includes/class-ckwc-integration.php:158
    192 msgid "Optional (only used if the above field is checked): Customize the label next to the opt-in checkbox."
    193 msgstr ""
    194 
    195 #: includes/class-ckwc-integration.php:165
     231#: includes/class-ckwc-integration.php:242
     232msgid "Customize the label next to the opt-in checkbox."
     233msgstr ""
     234
     235#: includes/class-ckwc-integration.php:249
    196236msgid "Opt-In Checkbox: Default Status"
    197237msgstr ""
    198238
    199 #: includes/class-ckwc-integration.php:168
     239#: includes/class-ckwc-integration.php:252
    200240msgid "The default state of the opt-in checkbox."
    201241msgstr ""
    202242
    203 #: includes/class-ckwc-integration.php:171
     243#: includes/class-ckwc-integration.php:255
    204244msgid "Checked"
    205245msgstr ""
    206246
    207 #: includes/class-ckwc-integration.php:172
     247#: includes/class-ckwc-integration.php:256
    208248msgid "Unchecked"
    209249msgstr ""
    210250
    211 #: includes/class-ckwc-integration.php:179
     251#: includes/class-ckwc-integration.php:263
    212252msgid "Opt-In Checkbox: Display Location"
    213253msgstr ""
    214254
    215 #: includes/class-ckwc-integration.php:182
    216 msgid "Where to display the opt-in checkbox on the checkout page (under Billing Info or Order Info)."
    217 msgstr ""
    218 
    219 #: includes/class-ckwc-integration.php:185
     255#: includes/class-ckwc-integration.php:266
     256msgid "Where to display the opt-in checkbox on the checkout page (under \"Billing details\" or \"Additional information\")."
     257msgstr ""
     258
     259#: includes/class-ckwc-integration.php:269
    220260msgid "Billing"
    221261msgstr ""
    222262
    223 #: includes/class-ckwc-integration.php:186
     263#: includes/class-ckwc-integration.php:270
    224264msgid "Order"
    225265msgstr ""
    226266
    227 #: includes/class-ckwc-integration.php:195
     267#: includes/class-ckwc-integration.php:279
    228268msgid "Purchase Data"
    229269msgstr ""
    230270
    231 #: includes/class-ckwc-integration.php:196
     271#: includes/class-ckwc-integration.php:280
    232272msgid "Send purchase data to ConvertKit."
    233273msgstr ""
    234274
    235 #: includes/class-ckwc-integration.php:199
     275#: includes/class-ckwc-integration.php:283
    236276msgid ""
    237277"If enabled, the customer's order data will be sent to ConvertKit. Their email address will always be subscribed to ConvertKit, <strong>regardless of the Customer's opt in status.</strong><br />\n"
     
    239279msgstr ""
    240280
    241 #: includes/class-ckwc-integration.php:212
     281#: includes/class-ckwc-integration.php:296
    242282msgid "Debug"
    243283msgstr ""
    244284
    245 #: includes/class-ckwc-integration.php:214
     285#: includes/class-ckwc-integration.php:298
    246286msgid "Write data to a log file"
    247287msgstr ""
    248288
    249 #: includes/class-ckwc-integration.php:219
    250 msgid "View Log File"
    251 msgstr ""
    252 
    253 #: includes/class-ckwc-integration.php:349
     289#: includes/class-ckwc-integration.php:303
     290msgid "View log file"
     291msgstr ""
     292
     293#: includes/class-ckwc-integration.php:510
    254294msgid "Please provide your ConvertKit API Key."
    255295msgstr ""
    256296
    257 #: includes/class-ckwc-integration.php:364
     297#: includes/class-ckwc-integration.php:525
    258298msgid "Your ConvertKit API Key appears to be invalid. Please double check the value."
    259299msgstr ""
    260300
    261301#. translators: %1$s: Form Name, %2$s: Form ID
    262 #: includes/class-ckwc-order.php:221
     302#: includes/class-ckwc-order.php:233
    263303msgid "[ConvertKit] Customer subscribed to the Form: %1$s [%2$s]"
    264304msgstr ""
    265305
    266306#. translators: %1$s: Tag Name, %2$s: Tag ID
    267 #: includes/class-ckwc-order.php:238
     307#: includes/class-ckwc-order.php:250
    268308msgid "[ConvertKit] Customer subscribed to the Tag: %1$s [%2$s]"
    269309msgstr ""
    270310
    271311#. translators: %1$s: Sequence Name, %2$s: Sequence ID
    272 #: includes/class-ckwc-order.php:256
     312#: includes/class-ckwc-order.php:268
    273313msgid "[ConvertKit] Customer subscribed to the Sequence: %1$s [%2$s]"
    274314msgstr ""
    275315
    276316#. translators: %1$s: Error Code, %2$s: Error Message
    277 #: includes/class-ckwc-order.php:360
     317#: includes/class-ckwc-order.php:372
    278318msgid "[ConvertKit] Send Purchase Data Error: %1$s %2$s"
    279319msgstr ""
    280320
    281 #: includes/class-ckwc-order.php:373
     321#: includes/class-ckwc-order.php:385
    282322msgid "[ConvertKit] Purchase Data sent successfully"
    283323msgstr ""
    284324
    285325#. translators: %1$s: PHP class name
    286 #: includes/class-wp-ckwc.php:185
     326#: includes/class-wp-ckwc.php:186
    287327msgid "ConvertKit for WooCommerce Error: Could not load Plugin class <strong>%1$s</strong>"
    288328msgstr ""
    289329
    290 #: includes/class-wp-ckwc.php:195
     330#: includes/class-wp-ckwc.php:196
    291331msgid "ConvertKit for WooCommerce Error"
     332msgstr ""
     333
     334#: views/backend/custom-field-dropdown-field.php:13
     335msgid "(Don't send or map)"
    292336msgstr ""
    293337
    294338#. translators: %1$s: Post Type Singular Name, %2$s: Link to Integration Settings
    295339#: views/backend/product/disabled.php:15
    296 msgid "To configure the ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this %1$s, %2$s and enter a valid API Key and Secret."
     340msgid "To configure the ConvertKit form, tag or sequence to subscribe customers to who purchase this %1$s, %2$s and enter a valid API Key and API Secret."
    297341msgstr ""
    298342
     
    302346
    303347#: views/backend/product/meta-box.php:14
    304 msgid "The ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this Product."
    305 msgstr ""
    306 
    307 #: views/backend/settings/subscription-disabled.php:17
     348msgid "The ConvertKit form, tag or sequence to subscribe customers to who purchase this product."
     349msgstr ""
     350
     351#. translators: Plugin Name
     352#: views/backend/review/notice.php:17
     353msgid "We'd be super grateful if you could spread the word about %s and give it a 5 star rating on WordPress?"
     354msgstr ""
     355
     356#: views/backend/review/notice.php:25
     357msgid "Yes, leave review"
     358msgstr ""
     359
     360#. translators: Plugin Name
     361#: views/backend/review/notice.php:32
     362msgid "No, I'm having issues with %s"
     363msgstr ""
     364
     365#: views/backend/settings/custom-field-disabled.php:18
     366msgid "To select the custom field to map this order value to, specify a valid API Key, API Secret, and click Save changes."
     367msgstr ""
     368
     369#: views/backend/settings/subscription-disabled.php:18
    308370msgid "To select the Form, Tag or Sequence to subscribe Customers to, specify a valid API Key and Secret, and click Save changes."
    309371msgstr ""
  • convertkit-for-woocommerce/tags/1.4.3/readme.txt

    r2668107 r2678577  
    4646
    4747== Changelog ==
     48
     49### 1.4.3 2022-02-14
     50* Added: Settings: Options to Map WooCommerce Order Data (Phone, Billing Address etc) to ConvertKit Custom Fields
     51* Added: Select2 dropdown for Forms, Tags and Sequence selection with search functionality for improved UX.
    4852
    4953### 1.4.2 2022-01-28
  • convertkit-for-woocommerce/tags/1.4.3/resources/backend/js/integration.js

    r2668107 r2678577  
    7878                        }
    7979
    80                         // Hide this row if the input or select element within the row has the CSS class of the setting name.
    81                         if ( $( 'input, select', $( this ) ).hasClass( setting ) ) {
     80                        // Hide this row if the input, select, link or span element within the row has the CSS class of the setting name.
     81                        if ( $( 'input, select, a, span', $( this ) ).hasClass( setting ) ) {
    8282                            $( this ).hide();
    8383                        }
  • convertkit-for-woocommerce/tags/1.4.3/views/backend/product/disabled.php

    r2668107 r2678577  
    1313    echo sprintf(
    1414        /* translators: %1$s: Post Type Singular Name, %2$s: Link to Integration Settings */
    15         esc_html__( 'To configure the ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this %1$s, %2$s and enter a valid API Key and Secret.', 'woocommerce-convertkit' ),
     15        esc_html__( 'To configure the ConvertKit form, tag or sequence to subscribe customers to who purchase this %1$s, %2$s and enter a valid API Key and API Secret.', 'woocommerce-convertkit' ),
    1616        esc_attr( $post_type->labels->singular_name ),
    1717        '<a href="' . esc_attr( admin_url( 'admin.php?page=wc-settings&tab=integration&section=ckwc' ) ) . '">' . esc_html__( 'enable the ConvertKit WooCommerce integration', 'woocommerce-convertkit' ) . '</a>'
  • convertkit-for-woocommerce/tags/1.4.3/views/backend/product/meta-box.php

    r2668107 r2678577  
    1212
    1313<p class="description">
    14     <?php esc_html_e( 'The ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this Product.', 'woocommerce-convertkit' ); ?>
     14    <?php esc_html_e( 'The ConvertKit form, tag or sequence to subscribe customers to who purchase this product.', 'woocommerce-convertkit' ); ?>
    1515</p>
    1616
  • convertkit-for-woocommerce/tags/1.4.3/views/backend/settings/subscription-disabled.php

    r2668107 r2678577  
    1515    </th>
    1616    <td class="forminp">
    17         <?php esc_html_e( 'To select the Form, Tag or Sequence to subscribe Customers to, specify a valid API Key and Secret, and click Save changes.', 'woocommerce-convertkit' ); ?>
     17        <span class="<?php echo esc_attr( $data['class'] ); ?>">
     18            <?php esc_html_e( 'To select the Form, Tag or Sequence to subscribe Customers to, specify a valid API Key and Secret, and click Save changes.', 'woocommerce-convertkit' ); ?>
     19        </span>
    1820    </td>
    1921</tr>
  • convertkit-for-woocommerce/tags/1.4.3/woocommerce-convertkit.php

    r2668107 r2678577  
    1010 * Plugin URI:  https://www.convertkit.com
    1111 * Description: Integrates WooCommerce with ConvertKit, allowing customers to be automatically sent to your ConvertKit account.
    12  * Version: 1.4.2
     12 * Version: 1.4.3
    1313 * Author: ConvertKit
    1414 * Author URI: https://www.convertkit.com
     
    1616 *
    1717 * WC requires at least: 3.0
    18  * WC tested up to: 6.1
     18 * WC tested up to: 6.2
    1919 */
    2020
     
    2828define( 'CKWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    2929define( 'CKWC_PLUGIN_PATH', __DIR__ );
    30 define( 'CKWC_PLUGIN_VERSION', '1.4.2' );
     30define( 'CKWC_PLUGIN_VERSION', '1.4.3' );
    3131
    3232// Load files that are always used.
     
    3737require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-order.php';
    3838require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource.php';
     39require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-custom-fields.php';
    3940require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-forms.php';
    4041require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-sequences.php';
    4142require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-tags.php';
     43require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-review-request.php';
    4244
    4345// Load files that are only used in the WordPress Administration interface.
  • convertkit-for-woocommerce/trunk/admin/class-ckwc-admin-product.php

    r2668107 r2678577  
    3535        $this->integration = WP_CKWC_Integration();
    3636
     37        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     38        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
    3739        add_action( 'add_meta_boxes_product', array( $this, 'add_meta_boxes' ) );
    3840        add_action( 'save_post_product', array( $this, 'save_product' ) );
     41
     42    }
     43
     44    /**
     45     * Enqueue Javascript for the WooCommerce Add / Edit Product screen.
     46     *
     47     * @since   1.4.3
     48     */
     49    public function enqueue_scripts() {
     50
     51        // Bail if we're not on the Add / Edit Product screen.
     52        if ( ! $this->is_edit_product_screen() ) {
     53            return;
     54        }
     55
     56        // Enqueue Select2 JS.
     57        ckwc_select2_enqueue_scripts();
     58
     59    }
     60
     61    /**
     62     * Enqueue CSS for the WooCommerce Add / Edit Product screen.
     63     *
     64     * @since   1.4.3
     65     */
     66    public function enqueue_styles() {
     67
     68        // Bail if we're not on the Add / Edit Product screen.
     69        if ( ! $this->is_edit_product_screen() ) {
     70            return;
     71        }
     72
     73        // Enqueue CSS.
     74        wp_enqueue_style( 'ckwc-product', CKWC_PLUGIN_URL . '/resources/backend/css/product.css', false, CKWC_PLUGIN_VERSION );
     75
     76        // Enqueue Select2 CSS.
     77        ckwc_select2_enqueue_styles();
    3978
    4079    }
     
    77116        $subscription = array(
    78117            'id'        => 'ckwc_subscription',
    79             'class'     => 'widefat',
     118            'class'     => 'ckwc-select2 widefat',
    80119            'name'      => 'ckwc_subscription',
    81120            'value'     => get_post_meta( $post->ID, 'ckwc_subscription', true ),
     
    127166    }
    128167
     168    /**
     169     * Checks if the request is for viewing the WooCommerce Add / Edit Product screen.
     170     *
     171     * @since   1.4.3
     172     *
     173     * @return  bool
     174     */
     175    private function is_edit_product_screen() {
     176
     177        // Return false if we cannot reliably determine the current screen that is viewed,
     178        // due to WordPress' get_current_screen() function being unavailable.
     179        if ( ! function_exists( 'get_current_screen' ) ) {
     180            return false;
     181        }
     182
     183        // Get screen.
     184        $screen = get_current_screen();
     185
     186        // Return false if we're not on the Add / Edit Product screen.
     187        if ( $screen->id !== 'product' ) {
     188            return false;
     189        }
     190
     191        return true;
     192
     193    }
     194
    129195}
  • convertkit-for-woocommerce/trunk/includes/class-ckwc-integration.php

    r2668107 r2678577  
    1717
    1818    /**
     19     * Holds the Form resources instance.
     20     *
     21     * @since   1.4.3
     22     *
     23     * @var     CKWC_Resource_Forms
     24     */
     25    private $forms;
     26
     27    /**
     28     * Holds the Form resources instance.
     29     *
     30     * @since   1.4.3
     31     *
     32     * @var     CKWC_Resource_Tags
     33     */
     34    private $tags;
     35
     36    /**
     37     * Holds the Form resources instance.
     38     *
     39     * @since   1.4.3
     40     *
     41     * @var     CKWC_Resource_Sequences
     42     */
     43    private $sequences;
     44
     45    /**
     46     * Holds the Form resources instance.
     47     *
     48     * @since   1.4.3
     49     *
     50     * @var     CKWC_Resource_Custom_Fields
     51     */
     52    private $custom_fields;
     53
     54    /**
    1955     * Constructor
    2056     *
     
    3571        if ( is_admin() ) {
    3672            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     73            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
    3774            add_action( "woocommerce_update_options_integration_{$this->id}", array( $this, 'process_admin_options' ) );
    3875            add_filter( "woocommerce_settings_api_sanitized_fields_{$this->id}", array( $this, 'sanitize_settings' ) );
     
    5289        $this->form_fields = array(
    5390            // Enable/Disable entire integration.
    54             'enabled'         => array(
     91            'enabled'                       => array(
    5592                'title'   => __( 'Enable/Disable', 'woocommerce-convertkit' ),
    5693                'type'    => 'checkbox',
     
    6097
    6198            // API Key and Secret.
    62             'api_key'         => array(
     99            'api_key'                       => array(
    63100                'title'       => __( 'API Key', 'woocommerce-convertkit' ),
    64101                'type'        => 'text',
     
    77114                'class'       => 'enabled',
    78115            ),
    79             'api_secret'      => array(
     116            'api_secret'                    => array(
    80117                'title'       => __( 'API Secret', 'woocommerce-convertkit' ),
    81118                'type'        => 'text',
     
    96133
    97134            // Subscribe.
    98             'event'           => array(
     135            'event'                         => array(
    99136                'title'       => __( 'Subscribe Event', 'woocommerce-convertkit' ),
    100137                'type'        => 'select',
     
    111148                'class'       => 'enabled subscribe',
    112149            ),
    113             'subscription'    => array(
     150            'subscription'                  => array(
    114151                'title'       => __( 'Subscription', 'woocommerce-convertkit' ),
    115152                'type'        => 'subscription',
    116153                'default'     => '',
    117                 'description' => __( 'The ConvertKit Form, Tag or Sequence to subscribe Customers to.', 'woocommerce-convertkit' ),
    118 
    119                 // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
    120                 'class'       => 'enabled subscribe',
    121             ),
    122             'name_format'     => array(
     154                'description' => __( 'The ConvertKit form, tag or sequence to subscribe customers to.', 'woocommerce-convertkit' ),
     155
     156                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     157                'class'       => 'enabled subscribe',
     158            ),
     159            'name_format'                   => array(
    123160                'title'       => __( 'Name Format', 'woocommerce-convertkit' ),
    124161                'type'        => 'select',
     
    136173            ),
    137174
     175            // Custom Field Mappings.
     176            'custom_field_phone'            => array(
     177                'title'       => __( 'Send Phone Number', 'woocommerce-convertkit' ),
     178                'type'        => 'custom_field',
     179                'default'     => '',
     180                'description' => __( 'The ConvertKit custom field to store the order\'s phone number.', 'woocommerce-convertkit' ),
     181
     182                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     183                'class'       => 'enabled subscribe',
     184            ),
     185            'custom_field_billing_address'  => array(
     186                'title'       => __( 'Send Billing Address', 'woocommerce-convertkit' ),
     187                'type'        => 'custom_field',
     188                'default'     => '',
     189                'description' => __( 'The ConvertKit custom field to store the order\'s billing address.', 'woocommerce-convertkit' ),
     190
     191                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     192                'class'       => 'enabled subscribe',
     193            ),
     194            'custom_field_shipping_address' => array(
     195                'title'       => __( 'Send Shipping Address', 'woocommerce-convertkit' ),
     196                'type'        => 'custom_field',
     197                'default'     => '',
     198                'description' => __( 'The ConvertKit custom field to store the order\'s shipping address.', 'woocommerce-convertkit' ),
     199
     200                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     201                'class'       => 'enabled subscribe',
     202            ),
     203            'custom_field_payment_method'   => array(
     204                'title'       => __( 'Send Payment Method', 'woocommerce-convertkit' ),
     205                'type'        => 'custom_field',
     206                'default'     => '',
     207                'description' => __( 'The ConvertKit custom field to store the order\'s payment method.', 'woocommerce-convertkit' ),
     208
     209                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     210                'class'       => 'enabled subscribe',
     211            ),
     212            'custom_field_customer_note'    => array(
     213                'title'       => __( 'Send Customer Note', 'woocommerce-convertkit' ),
     214                'type'        => 'custom_field',
     215                'default'     => '',
     216                'description' => __( 'The ConvertKit custom field to store the order\'s customer note.', 'woocommerce-convertkit' ),
     217
     218                // The setting name that needs to be checked/enabled for this setting to display. Used by JS to toggle visibility.
     219                'class'       => 'enabled subscribe',
     220            ),
     221
    138222            // Subscribe: Display Opt In Checkbox Settings.
    139             'display_opt_in'  => array(
     223            'display_opt_in'                => array(
    140224                'title'       => __( 'Opt-In Checkbox', 'woocommerce-convertkit' ),
    141                 'label'       => __( 'Display an Opt-In checkbox on checkout', 'woocommerce-convertkit' ),
     225                'label'       => __( 'Display an opt-in checkbox on checkout', 'woocommerce-convertkit' ),
    142226                'type'        => 'checkbox',
    143227                'default'     => 'no',
    144228                'description' => __(
    145                     'If enabled, customers will <strong>only</strong> be subscribed to the chosen Forms, Tags and Sequences if they check the "Opt-In" checkbox at checkout.<br />
    146                                       If disabled, customers will <strong>always</strong> be subscribed to the chosen Forms, Tags and Sequences at checkout.',
     229                    'If enabled, customers will <strong>only</strong> be subscribed to the chosen forms, tags and sequences if they check the opt-in checkbox at checkout.<br />
     230                                      If disabled, customers will <strong>always</strong> be subscribed to the chosen forms, tags and sequences at checkout.',
    147231                    'woocommerce-convertkit'
    148232                ),
     
    152236                'class'       => 'enabled subscribe',
    153237            ),
    154             'opt_in_label'    => array(
     238            'opt_in_label'                  => array(
    155239                'title'       => __( 'Opt-In Checkbox: Label', 'woocommerce-convertkit' ),
    156240                'type'        => 'text',
    157241                'default'     => __( 'I want to subscribe to the newsletter', 'woocommerce-convertkit' ),
    158                 'description' => __( 'Optional (only used if the above field is checked): Customize the label next to the opt-in checkbox.', 'woocommerce-convertkit' ),
     242                'description' => __( 'Customize the label next to the opt-in checkbox.', 'woocommerce-convertkit' ),
    159243                'desc_tip'    => false,
    160244
     
    162246                'class'       => 'enabled subscribe display_opt_in',
    163247            ),
    164             'opt_in_status'   => array(
     248            'opt_in_status'                 => array(
    165249                'title'       => __( 'Opt-In Checkbox: Default Status', 'woocommerce-convertkit' ),
    166250                'type'        => 'select',
     
    176260                'class'       => 'enabled subscribe display_opt_in',
    177261            ),
    178             'opt_in_location' => array(
     262            'opt_in_location'               => array(
    179263                'title'       => __( 'Opt-In Checkbox: Display Location', 'woocommerce-convertkit' ),
    180264                'type'        => 'select',
    181265                'default'     => 'billing',
    182                 'description' => __( 'Where to display the opt-in checkbox on the checkout page (under Billing Info or Order Info).', 'woocommerce-convertkit' ),
     266                'description' => __( 'Where to display the opt-in checkbox on the checkout page (under "Billing details" or "Additional information").', 'woocommerce-convertkit' ),
    183267                'desc_tip'    => false,
    184268                'options'     => array(
     
    192276
    193277            // Purchase Data.
    194             'send_purchases'  => array(
     278            'send_purchases'                => array(
    195279                'title'       => __( 'Purchase Data', 'woocommerce-convertkit' ),
    196280                'label'       => __( 'Send purchase data to ConvertKit.', 'woocommerce-convertkit' ),
     
    209293
    210294            // Debugging.
    211             'debug'           => array(
     295            'debug'                         => array(
    212296                'title'       => __( 'Debug', 'woocommerce-convertkit' ),
    213297                'type'        => 'checkbox',
    214298                'label'       => __( 'Write data to a log file', 'woocommerce-convertkit' ),
    215299                'description' => sprintf(
    216                     /* translators: %1$s: URL to Log File, %2$s: View Log File text */
     300                    /* translators: %1$s: URL to Log File, %2$s: View log file text */
    217301                    '<a href="%1$s" target="_blank">%2$s</a>',
    218302                    admin_url( 'admin.php?page=wc-status&tab=logs' ),
    219                     __( 'View Log File', 'woocommerce-convertkit' )
     303                    __( 'View log file', 'woocommerce-convertkit' )
    220304                ),
    221305                'default'     => 'no',
     
    235319    public function enqueue_scripts() {
    236320
    237         // Bail if we cannot determine if we are viewing the Integration Settings screen.
    238         if ( ! function_exists( 'get_current_screen' ) ) {
    239             return;
    240         }
    241 
    242         // Get screen.
    243         $screen = get_current_screen();
    244 
    245321        // Bail if we're not on the Integration Settings screen.
    246         if ( $screen->id !== 'woocommerce_page_wc-settings' ) {
     322        if ( ! $this->is_integration_settings_screen() ) {
    247323            return;
    248324        }
     
    250326        // Enqueue JS.
    251327        wp_enqueue_script( 'ckwc-integration', CKWC_PLUGIN_URL . 'resources/backend/js/integration.js', array( 'jquery' ), CKWC_PLUGIN_VERSION, true );
     328
     329        // Enqueue Select2 JS.
     330        ckwc_select2_enqueue_scripts();
     331
     332    }
     333
     334    /**
     335     * Enqueue CSS for the Integration Settings screen.
     336     *
     337     * @since   1.4.3
     338     */
     339    public function enqueue_styles() {
     340
     341        // Bail if we're not on the Integration Settings screen.
     342        if ( ! $this->is_integration_settings_screen() ) {
     343            return;
     344        }
     345
     346        // Enqueue Select2 CSS.
     347        ckwc_select2_enqueue_styles();
    252348
    253349    }
     
    282378        if ( ! $this->is_enabled() ) {
    283379            ob_start();
    284             require_once CKWC_PLUGIN_PATH . '/views/backend/settings/subscription-disabled.php';
     380            require CKWC_PLUGIN_PATH . '/views/backend/settings/subscription-disabled.php';
    285381            return ob_get_clean();
    286382        }
    287383
    288         // Get Forms, Tags and Sequences, refreshing them to fetch the latest data from the API.
    289         $forms = new CKWC_Resource_Forms();
    290         $forms->refresh();
    291         $sequences = new CKWC_Resource_Sequences();
    292         $sequences->refresh();
    293         $tags = new CKWC_Resource_Tags();
    294         $tags->refresh();
     384        // Get Forms, Tags and Sequences, refreshing them to fetch the latest data from the API,
     385        // if we haven't already fetched them.
     386        if ( ! $this->forms ) {
     387            $this->forms = new CKWC_Resource_Forms();
     388            $this->forms->refresh();
     389        }
     390        if ( ! $this->sequences ) {
     391            $this->sequences = new CKWC_Resource_Sequences();
     392            $this->sequences->refresh();
     393        }
     394        if ( ! $this->tags ) {
     395            $this->tags = new CKWC_Resource_Tags();
     396            $this->tags->refresh();
     397        }
    295398
    296399        // Get current subscription setting and other settings to render the subscription dropdown field.
    297400        $subscription = array(
    298401            'id'        => 'woocommerce_ckwc_subscription',
    299             'class'     => 'select ' . $data['class'],
     402            'class'     => 'select ckwc-select2 ' . $data['class'],
    300403            'name'      => $field,
    301404            'value'     => $this->get_option( $key ),
    302             'forms'     => $forms,
    303             'tags'      => $tags,
    304             'sequences' => $sequences,
     405            'forms'     => $this->forms,
     406            'tags'      => $this->tags,
     407            'sequences' => $this->sequences,
    305408        );
    306409
    307410        ob_start();
    308         require_once CKWC_PLUGIN_PATH . '/views/backend/settings/subscription.php';
     411        require CKWC_PLUGIN_PATH . '/views/backend/settings/subscription.php';
     412        return ob_get_clean();
     413
     414    }
     415
     416    /**
     417     * Output HTML for a Custom Field dropdown.
     418     *
     419     * Used when init_form_fields() field type is set to custom_field i.e. used
     420     * for Phone, Billing Address and Shipping Address to Custom Field mapping settings.
     421     *
     422     * @since   1.4.3
     423     *
     424     * @param   string $key    Setting Field Key.
     425     * @param   array  $data   Setting Field Configuration.
     426     */
     427    public function generate_custom_field_html( $key, $data ) {
     428
     429        $field    = $this->get_field_key( $key );
     430        $defaults = array(
     431            'title'             => '',
     432            'disabled'          => false,
     433            'class'             => '',
     434            'css'               => '',
     435            'placeholder'       => '',
     436            'type'              => 'text',
     437            'desc_tip'          => false,
     438            'description'       => '',
     439            'custom_attributes' => array(),
     440            'options'           => array(),
     441        );
     442
     443        $data = wp_parse_args( $data, $defaults );
     444
     445        // If the integration isn't enabled, don't output a selection field.
     446        if ( ! $this->is_enabled() ) {
     447            ob_start();
     448            include CKWC_PLUGIN_PATH . '/views/backend/settings/custom-field-disabled.php';
     449            return ob_get_clean();
     450        }
     451
     452        // Get Custom Fields, refreshing them to fetch the latest data from the API,
     453        // if we haven't already fetched them.
     454        if ( ! $this->custom_fields ) {
     455            $this->custom_fields = new CKWC_Resource_Custom_Fields();
     456            $this->custom_fields->refresh();
     457        }
     458
     459        // Get current custom field setting and other settings to render the custom field dropdown field.
     460        $custom_field = array(
     461            'id'            => $field,
     462            'class'         => 'select ' . $data['class'],
     463            'name'          => $field,
     464            'value'         => $this->get_option( $key ),
     465            'custom_fields' => $this->custom_fields,
     466        );
     467
     468        ob_start();
     469        include CKWC_PLUGIN_PATH . '/views/backend/settings/custom-field.php';
    309470        return ob_get_clean();
    310471
     
    421582
    422583    /**
     584     * Checks if the request is for this integration's settings screen.
     585     *
     586     * @since   1.4.3
     587     *
     588     * @return  bool
     589     */
     590    private function is_integration_settings_screen() {
     591
     592        // Return false if we cannot reliably determine the current screen that is viewed,
     593        // due to WordPress' get_current_screen() function being unavailable.
     594        if ( ! function_exists( 'get_current_screen' ) ) {
     595            return false;
     596        }
     597
     598        // Get screen.
     599        $screen = get_current_screen();
     600
     601        // Return false if we're not on the Integration Settings screen.
     602        if ( $screen->id !== 'woocommerce_page_wc-settings' ) {
     603            return false;
     604        }
     605
     606        return true;
     607
     608    }
     609
     610    /**
    423611     * Deletes all cached Forms, Tags and Sequences from the options table.
    424612     *
     
    436624        $sequences->delete();
    437625
     626        $custom_fields = new CKWC_Resource_Custom_Fields();
     627        $custom_fields->delete();
     628
    438629    }
    439630
  • convertkit-for-woocommerce/trunk/includes/class-ckwc-order.php

    r2668107 r2678577  
    5151        }
    5252
    53         // Subscribe customer's email address to a form or tag.
     53        // Subscribe customer's email address to a form, tag or sequence.
    5454        add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'maybe_subscribe_customer' ), 99999, 1 );
    5555        add_action( 'woocommerce_order_status_changed', array( $this, 'maybe_subscribe_customer' ), 99999, 3 );
     
    9797            return;
    9898        }
     99
     100        // If configured in the Integration, map Phone, Billing and/or Shipping Addresses to ConvertKit
     101        // Custom Fields now.
     102        $fields = $this->custom_field_data( $order );
    99103
    100104        // Build an array of Forms, Tags and Sequences to subscribe the Customer to, based on
     
    156160                $this->email( $order ),
    157161                $this->name( $order ),
    158                 $order_id
     162                $order_id,
     163                $fields
    159164            );
    160165        }
     166
     167        // The customer was subscribed to ConvertKit, so request a Plugin review.
     168        // This can safely be called multiple times, as the review request
     169        // class will ensure once a review request is dismissed by the user,
     170        // it is never displayed again.
     171        WP_CKWC()->get_class( 'review_request' )->request_review();
    161172
    162173    }
     
    173184     * @param   string $name           Customer Name.
    174185     * @param   int    $order_id       WooCommerce Order ID.
     186     * @param   mixed  $custom_fields  Custom Fields (false | array).
    175187     * @return  mixed                   WP_Error | array
    176188     */
    177     public function subscribe_customer( $resource_type, $resource_id, $email, $name, $order_id ) {
     189    public function subscribe_customer( $resource_type, $resource_id, $email, $name, $order_id, $custom_fields ) {
    178190
    179191        // Call API to subscribe the email address to the given Form, Tag or Sequence.
    180192        switch ( $resource_type ) {
    181193            case 'form':
    182                 $result = $this->api->form_subscribe( $resource_id, $email, $name );
     194                $result = $this->api->form_subscribe( $resource_id, $email, $name, $custom_fields );
    183195                break;
    184196
    185197            case 'tag':
    186                 $result = $this->api->tag_subscribe( $resource_id, $email );
     198                $result = $this->api->tag_subscribe( $resource_id, $email, $custom_fields );
    187199                break;
    188200
    189201            case 'sequence':
    190202            case 'course':
    191                 $result = $this->api->sequence_subscribe( $resource_id, $email );
     203                $result = $this->api->sequence_subscribe( $resource_id, $email, $custom_fields );
    192204                break;
    193205        }
     
    373385        $order->add_order_note( __( '[ConvertKit] Purchase Data sent successfully', 'woocommerce-convertkit' ) );
    374386
     387        // The customer's purchase data was sent to ConvertKit, so request a Plugin review.
     388        // This can safely be called multiple times, as the review request
     389        // class will ensure once a review request is dismissed by the user,
     390        // it is never displayed again.
     391        WP_CKWC()->get_class( 'review_request' )->request_review();
     392
    375393        // Return.
    376394        return $response;
     
    455473     * Returns the customer's email address for the given WooCommerce Order,
    456474     * immediately before it is sent to ConvertKit when subscribing the Customer
    457      * to a Form or Tag.
     475     * to a Form, Tag or Sequence.
    458476     *
    459477     * @since   1.0.0
     
    470488         * Returns the customer's email address for the given WooCommerce Order,
    471489         * immediately before it is sent to ConvertKit when subscribing the Customer
    472          * to a Form or Tag.
     490         * to a Form, Tag or Sequence.
    473491         *
    474492         * @since   1.0.0
     
    574592     * Returns the customer's last name for the given WooCommerce Order,
    575593     * immediately before it is sent to ConvertKit when subscribing the Customer
    576      * to a Form or Tag.
     594     * to a Form, Tag or Sequence.
    577595     *
    578596     * @since   1.0.0
     
    589607         * Returns the customer's last name for the given WooCommerce Order,
    590608         * immediately before it is sent to ConvertKit when subscribing the Customer
    591          * to a Form or Tag.
     609         * to a Form, Tag or Sequence.
    592610         *
    593611         * @since   1.0.0
     
    603621    }
    604622
     623    /**
     624     * Returns an array of ConvertKit Custom Field Key/Value pairs, with values
     625     * comprising of Order data based, to be sent to ConvertKit when an Order's
     626     * Customer is subscribed via a Form, Tag or Sequence.
     627     *
     628     * Returns false if no Order data should be stored in ConvertKit Custom Fields.
     629     *
     630     * @since   1.4.3
     631     *
     632     * @param   WC_Order|WC_Order_Refund $order  Order.
     633     * @return  mixed                            array | false
     634     */
     635    private function custom_field_data( $order ) {
     636
     637        $fields = array();
     638
     639        if ( $this->integration->get_option( 'custom_field_phone' ) ) {
     640            $fields[ $this->integration->get_option( 'custom_field_phone' ) ] = $order->get_billing_phone();
     641        }
     642        if ( $this->integration->get_option( 'custom_field_billing_address' ) ) {
     643            $fields[ $this->integration->get_option( 'custom_field_billing_address' ) ] = str_replace( '<br/>', ', ', $order->get_formatted_billing_address() );
     644        }
     645        if ( $this->integration->get_option( 'custom_field_shipping_address' ) ) {
     646            $fields[ $this->integration->get_option( 'custom_field_shipping_address' ) ] = str_replace( '<br/>', ', ', $order->get_formatted_shipping_address() );
     647        }
     648        if ( $this->integration->get_option( 'custom_field_payment_method' ) ) {
     649            $fields[ $this->integration->get_option( 'custom_field_payment_method' ) ] = $order->get_payment_method();
     650        }
     651        if ( $this->integration->get_option( 'custom_field_customer_note' ) ) {
     652            $fields[ $this->integration->get_option( 'custom_field_customer_note' ) ] = $order->get_customer_note();
     653        }
     654
     655        /**
     656         * Returns an array of ConvertKit Custom Field Key/Value pairs, with values
     657         * comprising of Order data based, to be sent to ConvertKit when an Order's
     658         * Customer is subscribed via a Form, Tag or Sequence.
     659         *
     660         * Returns false if no Order data should be stored in ConvertKit Custom Fields.
     661         *
     662         * @since   1.4.3
     663         *
     664         * @param   mixed                       $fields     Custom Field Key/Value pairs (false | array).
     665         * @param   WC_Order|WC_Order_Refund    $order      WooCommerce Order.
     666         */
     667        $fields = apply_filters( 'convertkit_for_woocommerce_custom_field_data', $fields, $order );
     668
     669        // If the fields array is empty, no Custom Field mappings exist.
     670        if ( ! count( $fields ) ) {
     671            return false;
     672        }
     673
     674        return $fields;
     675
     676    }
     677
    605678}
  • convertkit-for-woocommerce/trunk/includes/class-ckwc-resource.php

    r2668107 r2678577  
    125125                $results = $api->get_tags();
    126126                break;
     127
     128            case 'custom_fields':
     129                $results = $api->get_custom_fields();
     130                break;
    127131        }
    128132
  • convertkit-for-woocommerce/trunk/includes/class-wp-ckwc.php

    r2668107 r2678577  
    143143    private function initialize_global() {
    144144
    145         $this->classes['order'] = new CKWC_Order();
     145        $this->classes['order']          = new CKWC_Order();
     146        $this->classes['review_request'] = new CKWC_Review_Request( 'ConvertKit for WooCommerce', 'convertkit-for-woocommerce' );
    146147
    147148        /**
  • convertkit-for-woocommerce/trunk/includes/functions.php

    r2668107 r2678577  
    6868
    6969}
     70
     71/**
     72 * Helper method to enqueue Select2 scripts for use within the ConvertKit Plugin.
     73 *
     74 * @since   1.4.3
     75 */
     76function ckwc_select2_enqueue_scripts() {
     77
     78    wp_enqueue_script( 'ckwc-select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js', array( 'jquery' ), CKWC_PLUGIN_VERSION, false );
     79    wp_enqueue_script( 'ckwc-admin-select2', CKWC_PLUGIN_URL . '/resources/backend/js/select2.js', array( 'ckwc-select2' ), CKWC_PLUGIN_VERSION, false );
     80
     81}
     82
     83/**
     84 * Helper method to enqueue Select2 stylesheets for use within the ConvertKit Plugin.
     85 *
     86 * @since   1.4.3
     87 */
     88function ckwc_select2_enqueue_styles() {
     89
     90    wp_enqueue_style( 'ckwc-select2', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css', false, CKWC_PLUGIN_VERSION );
     91    wp_enqueue_style( 'ckwc-admin-select2', CKWC_PLUGIN_URL . '/resources/backend/css/select2.css', false, CKWC_PLUGIN_VERSION );
     92
     93}
  • convertkit-for-woocommerce/trunk/languages/woocommerce-convertkit.pot

    r2668107 r2678577  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: ConvertKit for WooCommerce 1.4.2\n"
     5"Project-Id-Version: ConvertKit for WooCommerce 1.4.3\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/convertkit-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-01-27T19:06:35+00:00\n"
     12"POT-Creation-Date: 2022-02-14T13:41:17+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.5.0\n"
     
    2929
    3030#. Author of the plugin
    31 #: includes/class-ckwc-integration.php:27
     31#: includes/class-ckwc-integration.php:63
    3232msgid "ConvertKit"
    3333msgstr ""
     
    3737msgstr ""
    3838
    39 #: admin/class-ckwc-admin-product.php:50
     39#: admin/class-ckwc-admin-product.php:89
    4040msgid "ConvertKit Integration"
    4141msgstr ""
     
    8080msgstr ""
    8181
    82 #: includes/class-ckwc-integration.php:28
     82#: includes/class-ckwc-integration.php:64
    8383msgid "Enter your ConvertKit settings below to control how WooCommerce integrates with your ConvertKit account."
    8484msgstr ""
    8585
    86 #: includes/class-ckwc-integration.php:55
     86#: includes/class-ckwc-integration.php:92
    8787msgid "Enable/Disable"
    8888msgstr ""
    8989
    90 #: includes/class-ckwc-integration.php:57
     90#: includes/class-ckwc-integration.php:94
    9191msgid "Enable ConvertKit integration"
    9292msgstr ""
    9393
    94 #: includes/class-ckwc-integration.php:63
     94#: includes/class-ckwc-integration.php:100
    9595msgid "API Key"
    9696msgstr ""
    9797
    9898#. translators: %1$s: Link to ConvertKit Account, %2$s: <br>, %3$s Link to ConvertKit Signup
    99 #: includes/class-ckwc-integration.php:69
    100 #: includes/class-ckwc-integration.php:86
     99#: includes/class-ckwc-integration.php:106
     100#: includes/class-ckwc-integration.php:123
    101101msgid "%1$s Required for proper plugin function. %2$s Don't have a ConvertKit account? %3$s"
    102102msgstr ""
    103103
    104 #: includes/class-ckwc-integration.php:70
     104#: includes/class-ckwc-integration.php:107
    105105msgid "Get your ConvertKit API Key."
    106106msgstr ""
    107107
    108 #: includes/class-ckwc-integration.php:72
    109 #: includes/class-ckwc-integration.php:89
     108#: includes/class-ckwc-integration.php:109
     109#: includes/class-ckwc-integration.php:126
    110110msgid "Sign up here."
    111111msgstr ""
    112112
    113 #: includes/class-ckwc-integration.php:80
     113#: includes/class-ckwc-integration.php:117
    114114msgid "API Secret"
    115115msgstr ""
    116116
    117 #: includes/class-ckwc-integration.php:87
     117#: includes/class-ckwc-integration.php:124
    118118msgid "Get your ConvertKit API Secret."
    119119msgstr ""
    120120
    121 #: includes/class-ckwc-integration.php:99
     121#: includes/class-ckwc-integration.php:136
    122122msgid "Subscribe Event"
    123123msgstr ""
    124124
    125 #: includes/class-ckwc-integration.php:102
     125#: includes/class-ckwc-integration.php:139
    126126msgid "When should customers be subscribed?"
    127127msgstr ""
    128128
    129 #: includes/class-ckwc-integration.php:105
     129#: includes/class-ckwc-integration.php:142
    130130msgid "Order Created"
    131131msgstr ""
    132132
    133 #: includes/class-ckwc-integration.php:106
     133#: includes/class-ckwc-integration.php:143
    134134msgid "Order Processing"
    135135msgstr ""
    136136
    137 #: includes/class-ckwc-integration.php:107
     137#: includes/class-ckwc-integration.php:144
    138138msgid "Order Completed"
    139139msgstr ""
    140140
    141 #: includes/class-ckwc-integration.php:114
     141#: includes/class-ckwc-integration.php:151
    142142msgid "Subscription"
    143143msgstr ""
    144144
    145 #: includes/class-ckwc-integration.php:117
    146 msgid "The ConvertKit Form, Tag or Sequence to subscribe Customers to."
    147 msgstr ""
    148 
    149 #: includes/class-ckwc-integration.php:123
     145#: includes/class-ckwc-integration.php:154
     146msgid "The ConvertKit form, tag or sequence to subscribe customers to."
     147msgstr ""
     148
     149#: includes/class-ckwc-integration.php:160
    150150msgid "Name Format"
    151151msgstr ""
    152152
    153 #: includes/class-ckwc-integration.php:126
     153#: includes/class-ckwc-integration.php:163
    154154msgid "How should the customer name be sent to ConvertKit?"
    155155msgstr ""
    156156
    157 #: includes/class-ckwc-integration.php:129
     157#: includes/class-ckwc-integration.php:166
    158158msgid "Billing First Name"
    159159msgstr ""
    160160
    161 #: includes/class-ckwc-integration.php:130
     161#: includes/class-ckwc-integration.php:167
    162162msgid "Billing Last Name"
    163163msgstr ""
    164164
    165 #: includes/class-ckwc-integration.php:131
     165#: includes/class-ckwc-integration.php:168
    166166msgid "Billing First Name + Billing Last Name"
    167167msgstr ""
    168168
    169 #: includes/class-ckwc-integration.php:140
     169#: includes/class-ckwc-integration.php:177
     170msgid "Send Phone Number"
     171msgstr ""
     172
     173#: includes/class-ckwc-integration.php:180
     174msgid "The ConvertKit custom field to store the order's phone number."
     175msgstr ""
     176
     177#: includes/class-ckwc-integration.php:186
     178msgid "Send Billing Address"
     179msgstr ""
     180
     181#: includes/class-ckwc-integration.php:189
     182msgid "The ConvertKit custom field to store the order's billing address."
     183msgstr ""
     184
     185#: includes/class-ckwc-integration.php:195
     186msgid "Send Shipping Address"
     187msgstr ""
     188
     189#: includes/class-ckwc-integration.php:198
     190msgid "The ConvertKit custom field to store the order's shipping address."
     191msgstr ""
     192
     193#: includes/class-ckwc-integration.php:204
     194msgid "Send Payment Method"
     195msgstr ""
     196
     197#: includes/class-ckwc-integration.php:207
     198msgid "The ConvertKit custom field to store the order's payment method."
     199msgstr ""
     200
     201#: includes/class-ckwc-integration.php:213
     202msgid "Send Customer Note"
     203msgstr ""
     204
     205#: includes/class-ckwc-integration.php:216
     206msgid "The ConvertKit custom field to store the order's customer note."
     207msgstr ""
     208
     209#: includes/class-ckwc-integration.php:224
    170210msgid "Opt-In Checkbox"
    171211msgstr ""
    172212
    173 #: includes/class-ckwc-integration.php:141
    174 msgid "Display an Opt-In checkbox on checkout"
    175 msgstr ""
    176 
    177 #: includes/class-ckwc-integration.php:144
     213#: includes/class-ckwc-integration.php:225
     214msgid "Display an opt-in checkbox on checkout"
     215msgstr ""
     216
     217#: includes/class-ckwc-integration.php:228
    178218msgid ""
    179 "If enabled, customers will <strong>only</strong> be subscribed to the chosen Forms, Tags and Sequences if they check the \"Opt-In\" checkbox at checkout.<br />\n"
    180 "\t\t\t\t\t\t\t\t\t  If disabled, customers will <strong>always</strong> be subscribed to the chosen Forms, Tags and Sequences at checkout."
    181 msgstr ""
    182 
    183 #: includes/class-ckwc-integration.php:155
     219"If enabled, customers will <strong>only</strong> be subscribed to the chosen forms, tags and sequences if they check the opt-in checkbox at checkout.<br />\n"
     220"\t\t\t\t\t\t\t\t\t  If disabled, customers will <strong>always</strong> be subscribed to the chosen forms, tags and sequences at checkout."
     221msgstr ""
     222
     223#: includes/class-ckwc-integration.php:239
    184224msgid "Opt-In Checkbox: Label"
    185225msgstr ""
    186226
    187 #: includes/class-ckwc-integration.php:157
     227#: includes/class-ckwc-integration.php:241
    188228msgid "I want to subscribe to the newsletter"
    189229msgstr ""
    190230
    191 #: includes/class-ckwc-integration.php:158
    192 msgid "Optional (only used if the above field is checked): Customize the label next to the opt-in checkbox."
    193 msgstr ""
    194 
    195 #: includes/class-ckwc-integration.php:165
     231#: includes/class-ckwc-integration.php:242
     232msgid "Customize the label next to the opt-in checkbox."
     233msgstr ""
     234
     235#: includes/class-ckwc-integration.php:249
    196236msgid "Opt-In Checkbox: Default Status"
    197237msgstr ""
    198238
    199 #: includes/class-ckwc-integration.php:168
     239#: includes/class-ckwc-integration.php:252
    200240msgid "The default state of the opt-in checkbox."
    201241msgstr ""
    202242
    203 #: includes/class-ckwc-integration.php:171
     243#: includes/class-ckwc-integration.php:255
    204244msgid "Checked"
    205245msgstr ""
    206246
    207 #: includes/class-ckwc-integration.php:172
     247#: includes/class-ckwc-integration.php:256
    208248msgid "Unchecked"
    209249msgstr ""
    210250
    211 #: includes/class-ckwc-integration.php:179
     251#: includes/class-ckwc-integration.php:263
    212252msgid "Opt-In Checkbox: Display Location"
    213253msgstr ""
    214254
    215 #: includes/class-ckwc-integration.php:182
    216 msgid "Where to display the opt-in checkbox on the checkout page (under Billing Info or Order Info)."
    217 msgstr ""
    218 
    219 #: includes/class-ckwc-integration.php:185
     255#: includes/class-ckwc-integration.php:266
     256msgid "Where to display the opt-in checkbox on the checkout page (under \"Billing details\" or \"Additional information\")."
     257msgstr ""
     258
     259#: includes/class-ckwc-integration.php:269
    220260msgid "Billing"
    221261msgstr ""
    222262
    223 #: includes/class-ckwc-integration.php:186
     263#: includes/class-ckwc-integration.php:270
    224264msgid "Order"
    225265msgstr ""
    226266
    227 #: includes/class-ckwc-integration.php:195
     267#: includes/class-ckwc-integration.php:279
    228268msgid "Purchase Data"
    229269msgstr ""
    230270
    231 #: includes/class-ckwc-integration.php:196
     271#: includes/class-ckwc-integration.php:280
    232272msgid "Send purchase data to ConvertKit."
    233273msgstr ""
    234274
    235 #: includes/class-ckwc-integration.php:199
     275#: includes/class-ckwc-integration.php:283
    236276msgid ""
    237277"If enabled, the customer's order data will be sent to ConvertKit. Their email address will always be subscribed to ConvertKit, <strong>regardless of the Customer's opt in status.</strong><br />\n"
     
    239279msgstr ""
    240280
    241 #: includes/class-ckwc-integration.php:212
     281#: includes/class-ckwc-integration.php:296
    242282msgid "Debug"
    243283msgstr ""
    244284
    245 #: includes/class-ckwc-integration.php:214
     285#: includes/class-ckwc-integration.php:298
    246286msgid "Write data to a log file"
    247287msgstr ""
    248288
    249 #: includes/class-ckwc-integration.php:219
    250 msgid "View Log File"
    251 msgstr ""
    252 
    253 #: includes/class-ckwc-integration.php:349
     289#: includes/class-ckwc-integration.php:303
     290msgid "View log file"
     291msgstr ""
     292
     293#: includes/class-ckwc-integration.php:510
    254294msgid "Please provide your ConvertKit API Key."
    255295msgstr ""
    256296
    257 #: includes/class-ckwc-integration.php:364
     297#: includes/class-ckwc-integration.php:525
    258298msgid "Your ConvertKit API Key appears to be invalid. Please double check the value."
    259299msgstr ""
    260300
    261301#. translators: %1$s: Form Name, %2$s: Form ID
    262 #: includes/class-ckwc-order.php:221
     302#: includes/class-ckwc-order.php:233
    263303msgid "[ConvertKit] Customer subscribed to the Form: %1$s [%2$s]"
    264304msgstr ""
    265305
    266306#. translators: %1$s: Tag Name, %2$s: Tag ID
    267 #: includes/class-ckwc-order.php:238
     307#: includes/class-ckwc-order.php:250
    268308msgid "[ConvertKit] Customer subscribed to the Tag: %1$s [%2$s]"
    269309msgstr ""
    270310
    271311#. translators: %1$s: Sequence Name, %2$s: Sequence ID
    272 #: includes/class-ckwc-order.php:256
     312#: includes/class-ckwc-order.php:268
    273313msgid "[ConvertKit] Customer subscribed to the Sequence: %1$s [%2$s]"
    274314msgstr ""
    275315
    276316#. translators: %1$s: Error Code, %2$s: Error Message
    277 #: includes/class-ckwc-order.php:360
     317#: includes/class-ckwc-order.php:372
    278318msgid "[ConvertKit] Send Purchase Data Error: %1$s %2$s"
    279319msgstr ""
    280320
    281 #: includes/class-ckwc-order.php:373
     321#: includes/class-ckwc-order.php:385
    282322msgid "[ConvertKit] Purchase Data sent successfully"
    283323msgstr ""
    284324
    285325#. translators: %1$s: PHP class name
    286 #: includes/class-wp-ckwc.php:185
     326#: includes/class-wp-ckwc.php:186
    287327msgid "ConvertKit for WooCommerce Error: Could not load Plugin class <strong>%1$s</strong>"
    288328msgstr ""
    289329
    290 #: includes/class-wp-ckwc.php:195
     330#: includes/class-wp-ckwc.php:196
    291331msgid "ConvertKit for WooCommerce Error"
     332msgstr ""
     333
     334#: views/backend/custom-field-dropdown-field.php:13
     335msgid "(Don't send or map)"
    292336msgstr ""
    293337
    294338#. translators: %1$s: Post Type Singular Name, %2$s: Link to Integration Settings
    295339#: views/backend/product/disabled.php:15
    296 msgid "To configure the ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this %1$s, %2$s and enter a valid API Key and Secret."
     340msgid "To configure the ConvertKit form, tag or sequence to subscribe customers to who purchase this %1$s, %2$s and enter a valid API Key and API Secret."
    297341msgstr ""
    298342
     
    302346
    303347#: views/backend/product/meta-box.php:14
    304 msgid "The ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this Product."
    305 msgstr ""
    306 
    307 #: views/backend/settings/subscription-disabled.php:17
     348msgid "The ConvertKit form, tag or sequence to subscribe customers to who purchase this product."
     349msgstr ""
     350
     351#. translators: Plugin Name
     352#: views/backend/review/notice.php:17
     353msgid "We'd be super grateful if you could spread the word about %s and give it a 5 star rating on WordPress?"
     354msgstr ""
     355
     356#: views/backend/review/notice.php:25
     357msgid "Yes, leave review"
     358msgstr ""
     359
     360#. translators: Plugin Name
     361#: views/backend/review/notice.php:32
     362msgid "No, I'm having issues with %s"
     363msgstr ""
     364
     365#: views/backend/settings/custom-field-disabled.php:18
     366msgid "To select the custom field to map this order value to, specify a valid API Key, API Secret, and click Save changes."
     367msgstr ""
     368
     369#: views/backend/settings/subscription-disabled.php:18
    308370msgid "To select the Form, Tag or Sequence to subscribe Customers to, specify a valid API Key and Secret, and click Save changes."
    309371msgstr ""
  • convertkit-for-woocommerce/trunk/readme.txt

    r2668107 r2678577  
    4646
    4747== Changelog ==
     48
     49### 1.4.3 2022-02-14
     50* Added: Settings: Options to Map WooCommerce Order Data (Phone, Billing Address etc) to ConvertKit Custom Fields
     51* Added: Select2 dropdown for Forms, Tags and Sequence selection with search functionality for improved UX.
    4852
    4953### 1.4.2 2022-01-28
  • convertkit-for-woocommerce/trunk/resources/backend/js/integration.js

    r2668107 r2678577  
    7878                        }
    7979
    80                         // Hide this row if the input or select element within the row has the CSS class of the setting name.
    81                         if ( $( 'input, select', $( this ) ).hasClass( setting ) ) {
     80                        // Hide this row if the input, select, link or span element within the row has the CSS class of the setting name.
     81                        if ( $( 'input, select, a, span', $( this ) ).hasClass( setting ) ) {
    8282                            $( this ).hide();
    8383                        }
  • convertkit-for-woocommerce/trunk/views/backend/product/disabled.php

    r2668107 r2678577  
    1313    echo sprintf(
    1414        /* translators: %1$s: Post Type Singular Name, %2$s: Link to Integration Settings */
    15         esc_html__( 'To configure the ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this %1$s, %2$s and enter a valid API Key and Secret.', 'woocommerce-convertkit' ),
     15        esc_html__( 'To configure the ConvertKit form, tag or sequence to subscribe customers to who purchase this %1$s, %2$s and enter a valid API Key and API Secret.', 'woocommerce-convertkit' ),
    1616        esc_attr( $post_type->labels->singular_name ),
    1717        '<a href="' . esc_attr( admin_url( 'admin.php?page=wc-settings&tab=integration&section=ckwc' ) ) . '">' . esc_html__( 'enable the ConvertKit WooCommerce integration', 'woocommerce-convertkit' ) . '</a>'
  • convertkit-for-woocommerce/trunk/views/backend/product/meta-box.php

    r2668107 r2678577  
    1212
    1313<p class="description">
    14     <?php esc_html_e( 'The ConvertKit Form, Tag or Sequence to subscribe Customers to who purchase this Product.', 'woocommerce-convertkit' ); ?>
     14    <?php esc_html_e( 'The ConvertKit form, tag or sequence to subscribe customers to who purchase this product.', 'woocommerce-convertkit' ); ?>
    1515</p>
    1616
  • convertkit-for-woocommerce/trunk/views/backend/settings/subscription-disabled.php

    r2668107 r2678577  
    1515    </th>
    1616    <td class="forminp">
    17         <?php esc_html_e( 'To select the Form, Tag or Sequence to subscribe Customers to, specify a valid API Key and Secret, and click Save changes.', 'woocommerce-convertkit' ); ?>
     17        <span class="<?php echo esc_attr( $data['class'] ); ?>">
     18            <?php esc_html_e( 'To select the Form, Tag or Sequence to subscribe Customers to, specify a valid API Key and Secret, and click Save changes.', 'woocommerce-convertkit' ); ?>
     19        </span>
    1820    </td>
    1921</tr>
  • convertkit-for-woocommerce/trunk/woocommerce-convertkit.php

    r2668107 r2678577  
    1010 * Plugin URI:  https://www.convertkit.com
    1111 * Description: Integrates WooCommerce with ConvertKit, allowing customers to be automatically sent to your ConvertKit account.
    12  * Version: 1.4.2
     12 * Version: 1.4.3
    1313 * Author: ConvertKit
    1414 * Author URI: https://www.convertkit.com
     
    1616 *
    1717 * WC requires at least: 3.0
    18  * WC tested up to: 6.1
     18 * WC tested up to: 6.2
    1919 */
    2020
     
    2828define( 'CKWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    2929define( 'CKWC_PLUGIN_PATH', __DIR__ );
    30 define( 'CKWC_PLUGIN_VERSION', '1.4.2' );
     30define( 'CKWC_PLUGIN_VERSION', '1.4.3' );
    3131
    3232// Load files that are always used.
     
    3737require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-order.php';
    3838require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource.php';
     39require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-custom-fields.php';
    3940require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-forms.php';
    4041require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-sequences.php';
    4142require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-resource-tags.php';
     43require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-review-request.php';
    4244
    4345// Load files that are only used in the WordPress Administration interface.
Note: See TracChangeset for help on using the changeset viewer.