Walkthrough: Automatically Apply Preconfigured Taxes to an Order
Beta release
This is pre-release documentation for an API in public beta and is subject to change.
Pricing options configured for an order affect the order's price calculation. For more information, see Automatically apply preconfigured catalog taxes or discounts.
In this walkthrough, you use the pricing option to apply automatic taxes based on taxes preconfigured for the catalog items.
First, you create the products you want to sell with taxes preconfigured. You then create example orders to explore how automatically applying preconfigured taxes affects the order's pricing calculation:
Create an order for coffee. In the request, specify the pricing option to automatically apply preconfigured taxes. The taxes apply to all line items in the order.
Update the order to remove the automatically applied tax from specific line items.
Create an order with automatic taxes enabled, but block specific line items.
In the response, verify that the catalog objects are created. The coffee items (of the ITEM type) should have the tax_ids field showing the tax enabled on it.
You need the coffee item variation ID to place the coffee order in the next step.
Link to section
Step 2: Test automatic taxes
Link to section
Step 2.1: Create an order with automatic taxes enabled
Call CreateOrder to create an order for a cup of coffee. In the request, include pricing_options to enable auto_apply_taxes.
Step 2.2: Update an order to remove previously applied automatic taxes
You can call UpdateOrder to remove specific taxes applied to specific line items. Add fields_to_clear to identify specific line items and specific taxes to remove. Update the preceding order by removing the specific taxes applied to the line item.
Make sure you provide the order ID, location ID, line item ID, and ID of the applied tax that you want to remove.
Step 2.3: Create an order with automatic taxes enabled, but block specific line items
Call CreateOrder to create an order for the coffee. In the request:
Specify pricing_options to automatically apply preconfigured taxes.
For the specific line item, add pricing_blocklists and include the ID of the CatalogTax object to block it from having taxes automatically applied.
Make sure you provide the coffee item variation ID, location ID, and ID of the tax (you created in step 1) that you want to block from automatic application.
In the response, verify the pricing calculations. Because you blocked the line item from having preconfigured taxes automatically applied, there are no taxes applied. The following is an example response fragment: