Integracja WooCommerce z BigQuery
Dowiedz się, jak połączyć WooCommerce z Google BigQuery w WitCloud, aby pobierać zamówienia, produkty i kategorie produktów ze sklepu.
Aktualizacja
Wprowadzenie
Ten moduł łączy Twój sklep WooCommerce z Google Cloud BigQuery. WitCloud odczytuje zamówienia, produkty i kategorie produktów przez WooCommerce REST API i zapisuje je w datasecie BigQuery Twojego projektu, gotowe do analizy i do tabel All in One.
Przewodnik konfiguracji
Wykonaj poniższe kroki, aby połączyć WooCommerce z BigQuery. WitCloud potrzebuje adresu Twojego sklepu i pary kluczy WooCommerce REST API (consumer key i consumer secret).
Utwórz klucz REST API przed rozpoczęciem: wkleisz go w WitCloud w kroku Autoryzacja. Wystarczy uprawnienie tylko do odczytu, ponieważ WitCloud tylko odczytuje dane ze sklepu.
Utwórz klucz REST API w WooCommerce
Ten krok wykonujesz w panelu administracyjnym WordPress / WooCommerce, który nie jest częścią WitCloud. Nazwy menu poniżej pochodzą z WooCommerce i mogą się różnić w zależności od jego wersji. Jeśli nie możesz ich znaleźć, zajrzyj do dokumentacji WooCommerce.
- Zaloguj się do panelu administracyjnego WordPress jako administrator.
- Przejdź do WooCommerce > Settings > Advanced > REST API i kliknij Add key.
- Wpisz opis, np. „WitCloud”, wybierz użytkownika i ustaw Permissions na Read.
- Kliknij Generate API key.
- Skopiuj Consumer key (zaczyna się od
ck_) i Consumer secret (zaczyna się odcs_). WooCommerce pokazuje secret tylko raz.
Zachowaj obie wartości w tajemnicy: każdy, kto je ma, może odczytać dane Twojego sklepu.
Konfiguracja modułu
Przejdź do Integracje i kliknij Dodaj integrację.

Wybierz WooCommerce z listy dostępnych integracji.

Wpisz Nazwa źródła danych, np. „WooCommerce PL”. Czytelna nazwa pomoże Ci później rozpoznać źródło danych.

Wpisz Adres URL sklepu: adres Twojego sklepu razem z https://, np. https://your-shop.com. Przycisk Autoryzuj jest nieaktywny, dopóki nie wpiszesz poprawnego adresu.

Autoryzacja
Jeśli ten sklep WooCommerce został już autoryzowany w WitCloud, wybierz istniejący token z listy Autoryzacja WooCommerce i pomiń dwa kolejne kroki.
Kliknij Autoryzuj.

W oknie Autoryzuj wpisz Identyfikator klienta (Client ID) (to consumer key z WooCommerce) i Sekret klienta (Client secret) (to consumer secret z WooCommerce), a następnie kliknij Utwórz. WitCloud sprawdza klucz w Twoim sklepie. Jeśli sklep jest nieosiągalny, adres lub klucz jest błędny albo klucz nie ma uprawnień do odczytu danych, powód pojawi się pod formularzem.

Zapisany token zostanie wybrany automatycznie. Token możesz też wybrać z listy Autoryzacja WooCommerce.

Ustawienia zaawansowane
Kliknij Pokaż ustawienia zaawansowane, aby zobaczyć trzy kolejne pola.
W polu Odświeżanie danych (produkty, stany magazynowe) wpisz, co ile godzin mają być odświeżane tabele przechowujące cały katalog (takie jak produkty). Wartość musi mieścić się między 4 a 12 godzin; domyślnie jest to 4.

Włącz Stały adres IP, jeśli Twój sklep jest za dodatkową ochroną sieciową, np. Cloudflare. Wszystkie zapytania o dane wychodzą wtedy z jednego stałego adresu IP, 34.118.32.227, który możesz dodać do listy dozwolonych adresów swojego sklepu.

W polu Tabele do pobrania możesz usunąć tabele, których nie potrzebujesz. Pole oferuje orders, products, categories i returns; domyślnie wszystkie są zaznaczone, a co najmniej jedna musi pozostać zaznaczona. Pobieranie mniejszej liczby tabel przyspiesza pobieranie danych.

Kliknij Dalej.

Dane historyczne i harmonogram
W polu Dane historyczne wpisz liczbę dni do pobrania przy pierwszym uruchomieniu, maksymalnie 365.

Harmonogram synchronizacji danych tworzy się automatycznie. Więcej informacji na ten temat znajdziesz tutaj.
Kliknij Utwórz, aby zakończyć konfigurację.

Gotowe! Dane z WooCommerce będą teraz synchronizowane z BigQuery. Zamówienia są pobierane dzień po dniu, a produkty i kategorie pobierane są w całości przy każdym uruchomieniu.
Schemat danych
Poniższe tabele pokazują dane pobierane z WooCommerce: zamówienia, produkty i kategorie produktów.
Schemat danych tabeli woocommerce_categories
| Field Name | Mode | Type |
|---|---|---|
| count | NULLABLE | INTEGER |
| description | NULLABLE | STRING |
| display | NULLABLE | STRING |
| id | NULLABLE | INTEGER |
| image | NULLABLE | RECORD |
| image.alt | NULLABLE | STRING |
| image.date_created | NULLABLE | TIMESTAMP |
| image.date_created_gmt | NULLABLE | TIMESTAMP |
| image.date_modified | NULLABLE | TIMESTAMP |
| image.date_modified_gmt | NULLABLE | TIMESTAMP |
| image.id | NULLABLE | INTEGER |
| image.name | NULLABLE | STRING |
| image.src | NULLABLE | STRING |
| menu_order | NULLABLE | INTEGER |
| name | NULLABLE | STRING |
| parent | NULLABLE | INTEGER |
| slug | NULLABLE | STRING |
Schemat danych tabeli woocommerce_orders
| Field Name | Mode | Type |
|---|---|---|
| billing | NULLABLE | RECORD |
| billing.address_1 | NULLABLE | STRING |
| billing.address_2 | NULLABLE | STRING |
| billing.city | NULLABLE | STRING |
| billing.company | NULLABLE | STRING |
| billing.country | NULLABLE | STRING |
| billing.email | NULLABLE | STRING |
| billing.first_name | NULLABLE | STRING |
| billing.last_name | NULLABLE | STRING |
| billing.phone | NULLABLE | STRING |
| billing.postcode | NULLABLE | STRING |
| billing.state | NULLABLE | STRING |
| cart_hash | NULLABLE | STRING |
| cart_tax | NULLABLE | FLOAT |
| coupon_lines | REPEATED | RECORD |
| coupon_lines.code | NULLABLE | STRING |
| coupon_lines.discount | NULLABLE | FLOAT |
| coupon_lines.discount_tax | NULLABLE | FLOAT |
| coupon_lines.id | NULLABLE | INTEGER |
| coupon_lines.meta_data | REPEATED | RECORD |
| coupon_lines.meta_data.display_key | NULLABLE | STRING |
| coupon_lines.meta_data.display_value | NULLABLE | JSON |
| coupon_lines.meta_data.id | NULLABLE | INTEGER |
| coupon_lines.meta_data.key | NULLABLE | STRING |
| coupon_lines.meta_data.value | NULLABLE | JSON |
| created_via | NULLABLE | STRING |
| currency | NULLABLE | STRING |
| currency_symbol | NULLABLE | STRING |
| customer_id | NULLABLE | INTEGER |
| customer_ip_address | NULLABLE | STRING |
| customer_note | NULLABLE | STRING |
| customer_user_agent | NULLABLE | STRING |
| date_completed | NULLABLE | TIMESTAMP |
| date_completed_gmt | NULLABLE | TIMESTAMP |
| date_created | NULLABLE | TIMESTAMP |
| date_created_gmt | NULLABLE | TIMESTAMP |
| date_modified | NULLABLE | TIMESTAMP |
| date_modified_gmt | NULLABLE | TIMESTAMP |
| date_paid | NULLABLE | TIMESTAMP |
| date_paid_gmt | NULLABLE | TIMESTAMP |
| discount_tax | NULLABLE | FLOAT |
| discount_total | NULLABLE | FLOAT |
| id | NULLABLE | INTEGER |
| is_editable | NULLABLE | BOOLEAN |
| line_items | REPEATED | RECORD |
| line_items.id | NULLABLE | INTEGER |
| line_items.image | NULLABLE | RECORD |
| line_items.image.id | NULLABLE | INTEGER |
| line_items.image.src | NULLABLE | STRING |
| line_items.meta_data | REPEATED | RECORD |
| line_items.meta_data.display_key | NULLABLE | STRING |
| line_items.meta_data.display_value | NULLABLE | JSON |
| line_items.meta_data.id | NULLABLE | INTEGER |
| line_items.meta_data.key | NULLABLE | STRING |
| line_items.meta_data.value | NULLABLE | JSON |
| line_items.name | NULLABLE | STRING |
| line_items.price | NULLABLE | FLOAT |
| line_items.product_id | NULLABLE | INTEGER |
| line_items.quantity | NULLABLE | INTEGER |
| line_items.sku | NULLABLE | STRING |
| line_items.subtotal | NULLABLE | FLOAT |
| line_items.subtotal_tax | NULLABLE | FLOAT |
| line_items.tax_class | NULLABLE | STRING |
| line_items.taxes | REPEATED | RECORD |
| line_items.taxes.id | NULLABLE | INTEGER |
| line_items.taxes.subtotal | NULLABLE | FLOAT |
| line_items.taxes.total | NULLABLE | FLOAT |
| line_items.total | NULLABLE | FLOAT |
| line_items.total_tax | NULLABLE | FLOAT |
| line_items.variation_id | NULLABLE | INTEGER |
| meta_data | REPEATED | RECORD |
| meta_data.id | NULLABLE | INTEGER |
| meta_data.key | NULLABLE | STRING |
| meta_data.value | NULLABLE | JSON |
| needs_payment | NULLABLE | BOOLEAN |
| needs_processing | NULLABLE | BOOLEAN |
| number | NULLABLE | INTEGER |
| order_key | NULLABLE | STRING |
| parent_id | NULLABLE | INTEGER |
| payment_method | NULLABLE | STRING |
| payment_method_title | NULLABLE | STRING |
| payment_url | NULLABLE | STRING |
| prices_include_tax | NULLABLE | BOOLEAN |
| shipping | NULLABLE | RECORD |
| shipping.address_1 | NULLABLE | STRING |
| shipping.address_2 | NULLABLE | STRING |
| shipping.city | NULLABLE | STRING |
| shipping.company | NULLABLE | STRING |
| shipping.country | NULLABLE | STRING |
| shipping.first_name | NULLABLE | STRING |
| shipping.last_name | NULLABLE | STRING |
| shipping.phone | NULLABLE | STRING |
| shipping.postcode | NULLABLE | STRING |
| shipping.state | NULLABLE | STRING |
| shipping_lines | REPEATED | RECORD |
| shipping_lines.id | NULLABLE | INTEGER |
| shipping_lines.instance_id | NULLABLE | INTEGER |
| shipping_lines.meta_data | REPEATED | RECORD |
| shipping_lines.meta_data.display_key | NULLABLE | STRING |
| shipping_lines.meta_data.display_value | NULLABLE | JSON |
| shipping_lines.meta_data.id | NULLABLE | INTEGER |
| shipping_lines.meta_data.key | NULLABLE | STRING |
| shipping_lines.meta_data.value | NULLABLE | JSON |
| shipping_lines.method_id | NULLABLE | STRING |
| shipping_lines.method_title | NULLABLE | STRING |
| shipping_lines.total | NULLABLE | FLOAT |
| shipping_lines.total_tax | NULLABLE | FLOAT |
| shipping_tax | NULLABLE | FLOAT |
| shipping_total | NULLABLE | FLOAT |
| status | NULLABLE | STRING |
| summary_page | NULLABLE | STRING |
| tax_lines | REPEATED | RECORD |
| tax_lines.compound | NULLABLE | BOOLEAN |
| tax_lines.id | NULLABLE | INTEGER |
| tax_lines.label | NULLABLE | STRING |
| tax_lines.rate_code | NULLABLE | STRING |
| tax_lines.rate_id | NULLABLE | INTEGER |
| tax_lines.rate_percent | NULLABLE | INTEGER |
| tax_lines.shipping_tax_total | NULLABLE | FLOAT |
| tax_lines.tax_total | NULLABLE | FLOAT |
| refunds | REPEATED | RECORD |
| refunds.id | NULLABLE | INTEGER |
| refunds.reason | NULLABLE | STRING |
| refunds.total | NULLABLE | FLOAT |
| total | NULLABLE | FLOAT |
| total_tax | NULLABLE | FLOAT |
| transaction_id | NULLABLE | STRING |
| version | NULLABLE | STRING |
Schemat danych tabeli woocommerce_products
| Field Name | Mode | Type |
|---|---|---|
| attributes | REPEATED | RECORD |
| attributes.id | NULLABLE | INTEGER |
| attributes.name | NULLABLE | STRING |
| attributes.options | REPEATED | STRING |
| attributes.position | NULLABLE | INTEGER |
| attributes.variation | NULLABLE | BOOLEAN |
| attributes.visible | NULLABLE | BOOLEAN |
| average_rating | NULLABLE | FLOAT |
| backordered | NULLABLE | BOOLEAN |
| backorders | NULLABLE | STRING |
| backorders_allowed | NULLABLE | BOOLEAN |
| brand_name | NULLABLE | STRING |
| button_text | NULLABLE | STRING |
| catalog_visibility | NULLABLE | STRING |
| categories | REPEATED | RECORD |
| categories.id | NULLABLE | INTEGER |
| categories.name | NULLABLE | STRING |
| categories.slug | NULLABLE | STRING |
| date_created | NULLABLE | TIMESTAMP |
| date_created_gmt | NULLABLE | TIMESTAMP |
| date_modified | NULLABLE | TIMESTAMP |
| date_modified_gmt | NULLABLE | TIMESTAMP |
| description | NULLABLE | STRING |
| dimensions | NULLABLE | RECORD |
| dimensions.height | NULLABLE | STRING |
| dimensions.length | NULLABLE | STRING |
| dimensions.width | NULLABLE | STRING |
| download_expiry | NULLABLE | INTEGER |
| download_limit | NULLABLE | INTEGER |
| downloadable | NULLABLE | BOOLEAN |
| external_url | NULLABLE | STRING |
| featured | NULLABLE | BOOLEAN |
| has_options | NULLABLE | BOOLEAN |
| id | NULLABLE | INTEGER |
| images | REPEATED | RECORD |
| images.alt | NULLABLE | STRING |
| images.date_created | NULLABLE | TIMESTAMP |
| images.date_created_gmt | NULLABLE | TIMESTAMP |
| images.date_modified | NULLABLE | TIMESTAMP |
| images.date_modified_gmt | NULLABLE | TIMESTAMP |
| images.id | NULLABLE | INTEGER |
| images.name | NULLABLE | STRING |
| images.src | NULLABLE | STRING |
| manage_stock | NULLABLE | BOOLEAN |
| menu_order | NULLABLE | INTEGER |
| meta_data | REPEATED | RECORD |
| meta_data.id | NULLABLE | INTEGER |
| meta_data.key | NULLABLE | STRING |
| meta_data.value | NULLABLE | JSON |
| name | NULLABLE | STRING |
| on_sale | NULLABLE | BOOLEAN |
| parent_id | NULLABLE | INTEGER |
| permalink | NULLABLE | STRING |
| price | NULLABLE | FLOAT |
| price_html | NULLABLE | STRING |
| product_brand | REPEATED | RECORD |
| product_brand.count | NULLABLE | INTEGER |
| product_brand.description | NULLABLE | STRING |
| product_brand.filter | NULLABLE | STRING |
| product_brand.name | NULLABLE | STRING |
| product_brand.parent | NULLABLE | INTEGER |
| product_brand.slug | NULLABLE | STRING |
| product_brand.taxonomy | NULLABLE | STRING |
| product_brand.term_group | NULLABLE | INTEGER |
| product_brand.term_id | NULLABLE | INTEGER |
| product_brand.term_taxonomy_id | NULLABLE | INTEGER |
| product_type | REPEATED | RECORD |
| product_type.count | NULLABLE | INTEGER |
| product_type.description | NULLABLE | STRING |
| product_type.filter | NULLABLE | STRING |
| product_type.name | NULLABLE | STRING |
| product_type.parent | NULLABLE | INTEGER |
| product_type.slug | NULLABLE | STRING |
| product_type.taxonomy | NULLABLE | STRING |
| product_type.term_group | NULLABLE | INTEGER |
| product_type.term_id | NULLABLE | INTEGER |
| product_type.term_taxonomy_id | NULLABLE | INTEGER |
| purchasable | NULLABLE | BOOLEAN |
| purchase_note | NULLABLE | STRING |
| rating_count | NULLABLE | INTEGER |
| regular_price | NULLABLE | FLOAT |
| related_ids | REPEATED | INTEGER |
| reviews_allowed | NULLABLE | BOOLEAN |
| sale_price | NULLABLE | STRING |
| shipping_class | NULLABLE | STRING |
| shipping_class_id | NULLABLE | INTEGER |
| shipping_required | NULLABLE | BOOLEAN |
| shipping_taxable | NULLABLE | BOOLEAN |
| short_description | NULLABLE | STRING |
| sku | NULLABLE | STRING |
| slug | NULLABLE | STRING |
| sold_individually | NULLABLE | BOOLEAN |
| status | NULLABLE | STRING |
| stock_quantity | NULLABLE | INTEGER |
| stock_status | NULLABLE | STRING |
| tax_class | NULLABLE | STRING |
| tax_status | NULLABLE | STRING |
| total_sales | NULLABLE | INTEGER |
| type | NULLABLE | STRING |
| upsell_ids | REPEATED | INTEGER |
| virtual | NULLABLE | BOOLEAN |
| weight | NULLABLE | STRING |
