Plugin Directory

Changeset 3094984


Ignore:
Timestamp:
05/30/2024 07:12:35 AM (22 months ago)
Author:
jnser
Message:

Adds customer meta data for stan customer id

Location:
stan-checkout/trunk/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stan-checkout/trunk/includes/classes/class-wc-stan-checkout-api-wrapper.php

    r3094967 r3094984  
    108108
    109109        try {
    110             $customer = WcStanCheckoutAPI::request( wc_stan()->get_settings_instance()->get_api_host() . '/v1/customers', 'POST', $payload );
     110            // $customer = WcStanCheckoutAPI::request( wc_stan()->get_settings_instance()->get_api_host() . '/v1/customers', 'POST', $payload );
     111            $customer = WcStanCheckoutAPI::request( 'http://host.docker.internal:3301/v1/customers', 'POST', $payload );
    111112            return $customer;
    112113        } catch (\Exception $e) {
  • stan-checkout/trunk/includes/classes/class-wc-stan-checkout-cart-api.php

    r3084399 r3094984  
    120120
    121121            if ( WC()->customer->get_email() !== null && WC()->customer->get_email() !== "" ) {
    122                 $customer = $client->create_customer_with_wc_customer( WC()->customer );
     122                $customer_id = get_user_meta( WC()->customer->get_id(), WC_STAN_CUSTOMER_ID, true );
    123123
    124                 $customer_id = $customer->id;
     124                if ( ! $customer_id ) {
     125                    $customer = $client->create_customer_with_wc_customer( WC()->customer );
     126   
     127                    update_user_meta( WC()->customer->get_id(), WC_STAN_CUSTOMER_ID, $customer->id, true );
     128   
     129                    $customer_id = $customer->id;
     130                }
    125131            }
    126132
  • stan-checkout/trunk/includes/wc-stan-constant.php

    r3077758 r3094984  
    7272const WC_EMAIL      = 'email';
    7373const WC_COMPANY    = 'company';
     74const WC_STAN_CUSTOMER_ID = 'stan_customer_id';
    7475
    7576const WC_PAYMENT_PENDING = 'wc-pending';
Note: See TracChangeset for help on using the changeset viewer.