Corso Avanzato Ecommerce
B2B API per Woocommerce
GROUPS API
DESCRIPTION
This API lets you retrieve and view all groups or a specific group by ID.
available meta fields:
- wcb2b_group_discount: contains global percentage discount assigned to group
Value is a floating number
In API GET response, has also a dedicated field alias named “wcb2b_group_discount_percentage” - wcb2b_group_min_purchase_amount: contains minimum purchase amount to purchase
Value is a floating number
In API GET response, has also a dedicated field alias named “wcb2b_group_min_purchase_amount” - wcb2b_group_packaging_fee: contains packaging fee.
Value is an associative array with:- type: type of fee. Can be “amount” or “percent”
- value: fee to apply. It’s a floating number
In API GET response, has also a dedicated field alias named “wcb2b_group_packaging_fee”
- wcb2b_group_terms_conditions: contains dedicated Terms and Conditions text
Value is a text (can include HTML)
In API GET response, has also a dedicated field alias named “wcb2b_group_terms_conditions” - wcb2b_group_shippings: contains shipping methods disabled
Value is a simple array with all shipping methods slugs to disable
In API GET response, has also a dedicated field alias named “wcb2b_group_disabled_shippings” - wcb2b_group_gateways: contains payment methods disabled
Value is a simple array with all payment methods slugs to disable
In API GET response, has also a dedicated field alias named “wcb2b_group_disabled_gateways”
HTTP REQUEST (ALL GROUPS)
int|string | $author | Author ID, or comma-separated list of IDs |
string | $author_name | User ‘user_nicename’ |
array | $author__in | An array of author IDs to query from |
array | $author__not_in | An array of author IDs not to query from |
array | $date_query | An associative array of WP_Date_Query arguments. See WP_Date_Query::__construct() |
bool | $exact | Whether to search by exact keyword. Default false |
array | $meta_query | An associative array of WP_Meta_Query arguments. See WP_Meta_Query |
int | $menu_order | The menu order of the posts |
string | $name | Post slug |
bool | $nopaging | Show all posts (true) or paginate (false). Default false |
bool | $no_found_rows | Whether to skip counting the total rows found. Enabling can improve performance. Default false |
int | $offset | The number of posts to offset before retrieval |
string | $order | Designates ascending or descending order of posts. Default ‘DESC’. Accepts ‘ASC’, ‘DESC’ |
string|array | $orderby | Sort retrieved posts by parameter |
int | $page | Show the number of posts that would show up on page X of a static front page |
int | $paged | The number of the current page |
string | $pagename | Page slug |
string | $perm | Show posts if user has the appropriate capability |
array | $post__in | An array of post IDs to retrieve, sticky posts will be included |
array | $post__not_in | An array of post IDs not to retrieve. Note: a string of comma-separated IDs will NOT work |
string|array | $post_status | A post status (string) or array of post statuses |
int | $posts_per_page | The number of posts to query for. Use -1 to request all posts |
array | $post_name__in | An array of post slugs that results must match |
string | $s | Search keyword(s). Prepending a term with a hyphen will exclude posts matching that term |
string | $title | Post title |
HTTP REQUEST (ALL GROUPS)
AVAILABLE PARAMETERS
int|string | $author | Author ID, or comma-separated list of IDs |
string | $author_name | User ‘user_nicename’ |
array | $author__in | An array of author IDs to query from |
array | $author__not_in | An array of author IDs not to query from |
array | $date_query | An associative array of WP_Date_Query arguments. See WP_Date_Query::__construct() |
bool | $exact | Whether to search by exact keyword. Default false |
array | $meta_query | An associative array of WP_Meta_Query arguments. See WP_Meta_Query |
int | $menu_order | The menu order of the posts |
string | $name | Post slug |
bool | $nopaging | Show all posts (true) or paginate (false). Default false |
bool | $no_found_rows | Whether to skip counting the total rows found. Enabling can improve performance. Default false |
int | $offset | The number of posts to offset before retrieval |
string | $order | Designates ascending or descending order of posts. Default ‘DESC’. Accepts ‘ASC’, ‘DESC’ |
string|array | $orderby | Sort retrieved posts by parameter |
int | $page | Show the number of posts that would show up on page X of a static front page |
int | $paged | The number of the current page |
string | $pagename | Page slug |
string | $perm | Show posts if user has the appropriate capability |
array | $post__in | An array of post IDs to retrieve, sticky posts will be included |
array | $post__not_in | An array of post IDs not to retrieve. Note: a string of comma-separated IDs will NOT work |
string|array | $post_status | A post status (string) or array of post statuses |
int | $posts_per_page | The number of posts to query for. Use -1 to request all posts |
array | $post_name__in | An array of post slugs that results must match |
string | $s | Search keyword(s). Prepending a term with a hyphen will exclude posts matching that term |
string | $title | Post title |
HTTP REQUEST (SINGLE GROUP)
EXAMPLE RESPONSE
{ "ID": 273, "post_author": "1", "post_date": "2020-06-13 00:00:00", "post_date_gmt": "2020-06-13 00:00:00", "post_content": "", "post_title": "Partners", "post_excerpt": "", "post_status": "publish", "comment_status": "closed", "ping_status": "closed", "post_password": "", "post_name": "partners", "to_ping": "", "pinged": "", "post_modified": "2020-06-13 00:00:00", "post_modified_gmt": "2020-06-13 00:00:00", "post_content_filtered": "", "post_parent": 0, "guid": "https://demosite.com/wcb2b_group/partners/", "menu_order": 0, "post_type": "wcb2b_group", "post_mime_type": "", "comment_count": "0", "filter": "raw", "wcb2b_group_discount_percentage": "10", "wcb2b_group_min_purchase_amount": "500", "wcb2b_group_packaging_fee": { "type": "percent", "value": "3" }, "wcb2b_group_terms_conditions": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", "wcb2b_group_disabled_shippings": [ "flat_rate" ], "wcb2b_group_disabled_gateways": [ "bacs", "cheque" ] }
HTTP REQUEST (CREATE GROUP)
EXAMPLE DATA
{"name": "Partners", wcb2b_group_discount":15}
HTTP REQUEST (UPDATE GROUP)
EXAMPLE DATA
{"wcb2b_group_discount":15}
HTTP REQUEST (DELETE GROUP)
PRODUCT API
DESCRIPTION
This API lets you retrieve and view all products or a specific product by ID.
available meta fields:
- wcb2b_product_group_prices: contains dedicated prices by group.
Value is a multidimensional array with GROUP ID as key and associative subarray:- regular_price: dedicated group regular price. It’s a floating number
- sale_price: dedicated group sale price. It’s a floating number
In API GET response, has also a dedicated field alias named “wcb2b_group_prices”
- wcb2b_product_group_tier_prices: contains tiered prices by group.
Value is a multidimensional array with GROUP ID as key and associative subarray:- {QUANTITY}: minimum quantity to apply tier price. It’s an integer number
- {PRICE}: tier price. It’s a floating number
In API GET response, has also a dedicated field alias named “wcb2b_group_tier_prices”
- wcb2b_barcode: contains product barcode.
Value is a string
In API GET response, has also a dedicated field alias named “wcb2b_barcode” - wcb2b_min: contains minimum quantity allowed.
Value is an integer number
In API GET response, has also a dedicated field alias named “wcb2b_min_quantity” - wcb2b_max: contains maximum quantity allowed.
Value is an integer number
In API GET response, has also a dedicated field alias named “wcb2b_max_quantity” - wcb2b_step: contains package increment quantity.
Value is an integer number
In API GET response, has also a dedicated field alias named “wcb2b_package_quantity” - wcb2b_product_group_hide_prices: contains groups with hidden prices.
Value is an array with GROUP IDs
In API GET response, has also a dedicated field alias named “wcb2b_group_hide_prices” - wcb2b_product_group_hide_stocks: contains groups with hidden stocks.
Value is an array with GROUP IDs
In API GET response, has also a dedicated field alias named “wcb2b_group_hide_stocks”
HTTP REQUEST (ALL PRODUCTS)
HTTP REQUEST (SINGLE PRODUCT)
EXAMPLE RESPONSE
{ "id": 60, "name": "T-Shirt with Logo", "slug": "t-shirt-with-logo", "permalink": "https://demosite.com/product/t-shirt-with-logo/", "date_created": "2020-06-13 00:00:00", "date_created_gmt": "2020-06-13 00:00:00", "date_modified": "2020-06-13 00:00:00", "date_modified_gmt": "2020-06-13 00:00:00", "type": "simple", "status": "publish", "featured": false, "catalog_visibility": "visible", "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n", "short_description": "<p>This is a simple product.</p>\n", "sku": "Woo-tshirt-logo", "price": "98", "regular_price": "100", "sale_price": "98", "date_on_sale_from": null, "date_on_sale_from_gmt": null, "date_on_sale_to": null, "date_on_sale_to_gmt": null, "price_html": "<del><span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>100.00</span></del> <ins><span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>98.00</span></ins>", "on_sale": true, "purchasable": true, "total_sales": 0, "virtual": false, "downloadable": false, "downloads": [], "download_limit": 0, "download_expiry": 0, "external_url": "", "button_text": "", "tax_status": "taxable", "tax_class": "", "manage_stock": false, "stock_quantity": null, "stock_status": "instock", "backorders": "no", "backorders_allowed": false, "backordered": false, "sold_individually": false, "weight": "", "dimensions": { "length": "10", "width": "12", "height": "0.5" }, "shipping_required": true, "shipping_taxable": true, "shipping_class": "", "shipping_class_id": 0, "reviews_allowed": true, "average_rating": "0.00", "rating_count": 0, "related_ids": [ 50, 40, 43, 51 ], "upsell_ids": [], "cross_sell_ids": [], "parent_id": 0, "purchase_note": "", "categories": [ { "id": 20, "name": "Tshirts", "slug": "tshirts-clothing" } ], "tags": [], "images": [ { "id": 83, "date_created": "2020-06-13 00:00:00", "date_created_gmt": "2020-06-13 00:00:00", "date_modified": "2020-06-13 00:00:00", "date_modified_gmt": "2020-06-13 00:00:00", "src": "https://demosite.com/wp-content/uploads/2020/06/t-shirt-with-logo-1.jpg", "name": "t-shirt-with-logo-1.jpg", "alt": "" } ], "attributes": [ { "id": 1, "name": "Color", "position": 0, "visible": true, "variation": false, "options": [ "Gray" ] } ], "default_attributes": [], "variations": [], "grouped_products": [], "menu_order": 0, "meta_data": [ { "id": 967, "key": "_wpcom_is_markdown", "value": "1" }, { "id": 3150, "key": "wcb2b_barcode", "value": "0123456789" }, { "id": 3151, "key": "wcb2b_step", "value": "10" }, { "id": 3152, "key": "wcb2b_min", "value": "20" }, { "id": 3153, "key": "wcb2b_max", "value": "200" }, { "id": 245144, "key": "wcb2b_product_group_hide_prices", "value": [ 275 ] }, { "id": 245145, "key": "wcb2b_product_group_hide_stocks", "value": [ 275 ] }, { "id": 3154, "key": "wcb2b_product_group_prices", "value": { "274": { "regular_price": "", "sale_price": "" }, "275": { "regular_price": "", "sale_price": "" }, "276": { "regular_price": "95.00", "sale_price": "" }, "277": { "regular_price": "98.00", "sale_price": "" }, "278": { "regular_price": "80.00", "sale_price": "78.00" } } }, { "id": 3155, "key": "wcb2b_product_group_tier_prices", "value": { "275": { "100": "50.00" }, "278": { "5": "75.00", "10": "74.00", "20": "70.00" } } } ], "wcb2b_group_hide_prices": [ [ 275 ] ], "wcb2b_group_tier_prices": [ { "275": { "100": "50.00" }, "278": { "5": "75.00", "10": "74.00", "20": "70.00" } } ], "wcb2b_group_prices": [ { "274": { "regular_price": "", "sale_price": "" }, "275": { "regular_price": "", "sale_price": "" }, "276": { "regular_price": "95.00", "sale_price": "" }, "277": { "regular_price": "98.00", "sale_price": "" }, "278": { "regular_price": "80.00", "sale_price": "78.00" } } ], "wcb2b_barcode": [ "0123456789" ], "wcb2b_max_quantity": [ "200" ], "wcb2b_min_quantity": [ "20" ], "wcb2b_package_quantity": [ "10" ], "_links": { "self": [ { "href": "https://demosite.com/wp-json/wc/v3/products/60" } ], "collection": [ { "href": "https://demosite.com/wp-json/wc/v3/products" } ] } }
CUSTOMER API
DESCRIPTION
This API lets you retrieve and view all customers or a specific customer by ID.
available meta fields:
- wcb2b_group: contains customer assigned Group ID.
Value is an integer number
In API GET response, has also a dedicated field alias named “wcb2b_group” - wcb2b_status: contains customer status (if moderate registration is enabled).
Value can be 0 (=disabled) or 1 (=enabled)
In API GET response, has also a dedicated field alias named “wcb2b_status” - billing_vat: contains customer VAT number.
Value is a string
In API GET response, it’s also available in billing address data
HTTP REQUEST (ALL CUSTOMERS)
HTTP REQUEST (SINGLE CUSTOMER)
EXAMPLE RESPONSE
{ "id": 2, "date_created": "2020-06-13T00:00:0", "date_created_gmt": "2020-06-13T00:0:0", "date_modified": "2020-06-13T00:00:00", "date_modified_gmt": "2020-06-13T00:00:00", "email": "cu******@de******.com", "first_name": "John", "last_name": "Doe", "role": "customer", "username": "customer", "billing": { "first_name": "John", "last_name": "Doe", "company": "Google LLC", "address_1": "Central Park, 1", "address_2": "", "city": "New York", "postcode": "10001", "country": "US", "state": "NY", "email": "cu******@de******.com", "phone": "212-223-6457", "vat_number": "0987654321" }, "shipping": { "first_name": "John", "last_name": "Doe", "company": "Google LLC", "address_1": "Central Park, 1", "address_2": "", "city": "New York", "postcode": "10001", "country": "US", "state": "NY" }, "is_paying_customer": true, "avatar_url": "https://secure.gravatar.com/avatar/25c626881bff6847aa6efc0820f01ec5?s=96&d=mm&r=g", "meta_data": [ { "id": 62, "key": "wc_last_active", "value": "1592092800" }, { "id": 353, "key": "shipping_method", "value": [ "flat_rate:2" ] }, { "id": 830, "key": "wcb2b_group", "value": "277" }, { "id": 848, "key": "wcb2b_status", "value": "1" }, { "id": 850, "key": "billing_vat", "value": "0987654321" } ], "wcb2b_status": 1, "wcb2b_group": { "id": 277, "name": "Partners", "discount": "15" }, "_links": { "self": [ { "href": "https://demosite.com/wp-json/wc/v3/customers/2" } ], "collection": [ { "href": "https://demosite.com/wp-json/wc/v3/customers" } ] } }
ORDER API
DESCRIPTION This API lets you retrieve and view all orders or a specific order by ID.
available meta fields:
- _wcb2b_group: contains customer assigned group when order placed.
Value is an integer number
In API GET response, has also a dedicated field alias named “wcb2b_group” - _total_weight: contains cart products total weight when order placed.
Value is a floating number
In API GET response, has also a dedicated field alias named “wcb2b_total_weight”
HTTP REQUEST (ALL ORDERS)
HTTP REQUEST (SINGLE ORDER)
EXAMPLE RESPONSE
{
"id": 101,
"parent_id": 0,
"number": "101",
"order_key": "wc_order_AZ59JpOFpEQcv",
"created_via": "checkout",
"version": "4.3.0",
"status": "completed",
"currency": "USD",
"date_created": "2020-06-13T02:00:0",
"date_created_gmt": "2020-06-13T00:00:0",
"date_modified": "2020-06-13T02:00:0",
"date_modified_gmt": "2020-06-13T00:00:0",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "20.00",
"shipping_tax": "4.40",
"cart_tax": "51.12",
"total": "307.90",
"total_tax": "55.52",
"prices_include_tax": true,
"customer_id": 2,
"customer_ip_address": "***",
"customer_user_agent": "***",
"customer_note": "",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "Google LLC",
"address_1": "Central Park, 1",
"address_2": "",
"city": "New York",
"state": "NY",
"postcode": "10001",
"country": "US",
"email": "cu******@de******.com",
"phone": "2122236457"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "Google LLC",
"address_1": "Central Park, 1",
"address_2": "",
"city": "New York",
"state": "NY",
"postcode": "10001",
"country": "US"
},
"payment_method": "bacs",
"payment_method_title": "Direct bank transfer",
"transaction_id": "",
"date_paid": "2020-06-13T02:00:0",
"date_paid_gmt": "2020-06-13T00:00:0",
"date_completed": "2020-06-13T02:00:0",
"date_completed_gmt": "2020-06-13T00:00:0",
"cart_hash": "4c4d2a2498f758a949a05f83a439b8e5",
"meta_data": [
{
"id": 5360,
"key": "_billing_vat",
"value": "1234567890"
},
{
"id": 5361,
"key": "is_vat_exempt",
"value": "no"
},
{
"id": 5365,
"key": "_total_weight",
"value": "2"
},
{
"id": 5366,
"key": "_wcb2b_group",
"value": "74"
}
],
"line_items": [
{
"id": 9,
"name": "Hoodie - Blue, Yes",
"product_id": 12,
"variation_id": 35,
"quantity": 7,
"tax_class": "",
"subtotal": "232.38",
"subtotal_tax": "51.12",
"total": "232.38",
"total_tax": "51.12",
"taxes": [
{
"id": 1,
"total": "51.12",
"subtotal": "51.12"
}
],
"meta_data": [
{
"id": 82,
"key": "pa_color",
"value": "blue",
"display_key": "Color",
"display_value": "Blue"
},
{
"id": 83,
"key": "logo",
"value": "Yes",
"display_key": "Logo",
"display_value": "Yes"
}
],
"sku": "woo-hoodie-blue-logo",
"price": 33.19672128571428,
"parent_name": "Hoodie"
}
],
"tax_lines": [
{
"id": 11,
"rate_code": "TAX-1",
"rate_id": 1,
"label": "Tax",
"compound": false,
"tax_total": "51.12",
"shipping_tax_total": "4.40",
"rate_percent": 22,
"meta_data": []
}
],
"shipping_lines": [
{
"id": 10,
"method_title": "Flat rate",
"method_id": "flat_rate",
"instance_id": "2",
"total": "20.00",
"total_tax": "4.40",
"taxes": [
{
"id": 1,
"total": "4.4",
"subtotal": ""
}
],
"meta_data": [
{
"id": 90,
"key": "Products",
"value": "Hoodie - Blue, Yes × 7",
"display_key": "Products",
"display_value": "Hoodie - Blue, Yes × 7"
}
]
}
],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"currency_symbol": "$",
"wcb2b_group": 74,
"wcb2b_group": 2,
"wcb2b_total_weight": {
"self": [
{
"href": "https://demosite.com/wp-json/wc/v3/orders/101"
}
],
"collection": [
{
"href": "https://demosite.com/wp-json/wc/v3/orders"
}
],
"customer": [
{
"href": "https://demosite.com/wp-json/wc/v3/customers/2"
}
]
}
}

Digital Agency per piccole e medie imprese
Potenzia la tua azienda con le nostre soluzioni
035.244295
Invia una richiesta
Via Provinciale, 2 - 24040 Lallio (BG)