# Unleashed Woocommerce Integration

### Hooks

Filter Order data before sending to Unleashed

“`php
$orderData = apply_filters(‘gsuw_before_create_order’, $orderData, $wcOrder);
“`

Filter Customer data before creating customer in Unleashed

“`php
$customerData = apply_filters(‘gsuw_before_create_customer’, $customerData, $order);
“`

Filter Customer data before updating customer in Unleashed (used when updating customer currency)

“`php
$customerData = apply_filters(‘gsuw_before_update_customer’, $customerData);
“`

Filter to validate returned or created Unleashed customer and WC order data is OK before creating order. Return an error string for a single second attempt to recreate order in 1 minute. Order sync will fail with error alert if error is returned on the second attempt.

“`php
$shouldRetryError = apply_filters(‘gsuw_retry_order_creation_later’, $shouldRetryError = ”, $customer, $order, $secondAttempt);
“`

Filter matching Unleashed tax rate for Order (unleashedTax is by default the first Tax Rate in Unleashed that matches the WC order tax rate e.g. 0.2 (20%))

“`php
$unleashedTax = apply_filters(‘gsuw_selected_unleashed_tax’, $unleashedTax, $orderTaxRate, $orderTaxCode, $wcOrder, $allUnleashedTaxes);
“`

Choose to exclude a product from being having it’s stock synced to Unleashed

“`php
$shouldSync = apply_filters(‘gsuw_before_sync_stock_single_product’, $shouldSync == true, $product);
“`

Stock sync timeout (default 20 minutes)

“`php
$syncTimeout = apply_filters(‘gsuw_sync_timeout’, 20 * 60);
“`

### Orders

– Orders are pushed to Unleashed upon order status change (status can be determined)
– Orders can be force synced by using the sync order action on the order page (under Order Actions)

### Stock

– Stock is pulled from Unleashed for all products periodically (can be determined). Supports multiple warehouses.