- Search for the desired t-shirt:
commercelayer resources:get skus -w name_i_cont_all=t-shirt,pink -w name_not_i_cont_all=women,white
Example ID of t-shirt selected: NzWOpOSyBx
.
- Get the markets:
cl resources:get markets
Example ID of market selected: DvlGRmhdgX
.
- Create a new order:
cl resources:create orders -r market=markets/DvlGRmhdgX
Example ID of order created: eqkykhrAwO
.
- Create a line item:
cl resources:create line_items -a quantity=1 -r order=orders/eqkykhrAwO -r item=skus/NzWOpOSyBx
Example ID of line item created: EvPrYtbryZ
.
- Check if the line_item has been added correctly:
cl resources:get orders eqkykhrAwO -i=line_items
- Update the order with a customer (customer creation shorthand):
cl resources:update orders/eqkykhrAwO -a [email protected]
- Check if the customer has been added correctly:
cl resources:get orders eqkykhrAwO -i=customer
Example ID of customer created: lnjmyhjykx
.
- Create an address:
cl resources:create addresses -a first_name=Silvio last_name=Relli line_1="Via Foo Bar, 123" city=Florence zip_code=50100 state_code=FI country_code=IT phone=33812345678
Example ID of address created: YBoeluGlWN
.
- Update the order with the address:
cl resources:update orders/eqkykhrAwO -r billing_address=addresses/YBoeluGlWN shipping_address=addresses/YBoeluGlWN
- Check if the address has been added correctly:
cl resources:get orders eqkykhrAwO -i billing_address,shipping_address
- Get the order shipments and the available shipping methods:
cl resources:get orders eqkykhrAwO -i shipments,shipments.available_shipping_methods
Example ID of order shipment created: WPwnrCkJep
.
Example ID of shipment method selected: JnEdaPFAOP
.
- Update the shipment with the selected shipping_method:
cl resources:update shipments/WPwnrCkJep -r shipping_method=shipping_methods/JnEdaPFAOP
- Check if the shipping method has been added correctly:
cl resources:get shipments WPwnrCkJep -i shipping_method
- Get the available payment methods for the order:
cl resources:get orders eqkykhrAwO -i available_payment_methods
Example ID of payment method created: gXmLyeszkP
.
- Update the order with the selected payment method:
cl resources:update orders/eqkykhrAwO -r payment_method=payment_methods/gXmLyeszkP
- Create the payment source and add it to the order:
cl resources:create wire_transfer -r order=orders/eqkykhrAwO
- Check if the payment method and the payment source have been added correctly:
cl resources:get orders eqkykhrAwO -i payment_method,payment_source
- Place the order:
cl resources:update orders/eqkykhrAwO -a _place=true