Ask your Question

Play online Skills Quiz

PEOPLE YOU MIGHT KNOW

Chữa vô sinh hiếm muộn
Chữa vô sinh hiếm muộn

chuavosinhhh

Hà Nội,  Vietnam
Bakefresh
Bakefresh

Ludhiana,  India
ellen
ellen

Napakiak,  United States
Top App
Top App

New York,  United States
Anjani
Anjani

Art Work

Varanasi,  India

Write to us

Ask Question

Magento 2 API Add Shipping Information To Cart For Guest Customer

Magento 2 API Add Shipping Information To  Cart For Guest Customer

ENDPOINT :  /rest/V1/guest-carts/{cartId}/shipping-information

e.g : http://localhost.magento.com/rest/V1/guest-carts/DnsT4UjkMPPdID4K53h4ToaXMSElc8pI/shipping-information

METHOD : POST

HEADERS : Content-Type application/json

                    Authorization : Bearer


PAYLOAD:
  
{  "addressInformation": {
       "shipping_address": {
       "region": "New York",
       "region_id": 43,
       "region_code": "NY",
       "country_id": "US",
       "street": [
      "123 Oak Ave"
    ],
    "postcode": "35004",
    "city": "Purchase",
    "firstname": "Jane",
    "lastname": "Doe",
    "email": "jdoe@example.com",
    "telephone": "512-555-1111"
  },
  "billing_address": {
    "region": "New York",
    "region_id": 43,
    "region_code": "NY",
    "country_id": "US",
    "street": [
      "123 Oak Ave"
    ],
    "postcode": "35004",
    "city": "Purchase",
    "firstname": "Jane",
    "lastname": "Doe",
    "email": "jdoe@example.com",
    "telephone": "512-555-1111"
  },
  "shipping_carrier_code": "freeshipping",
  "shipping_method_code": "freeshipping"
  }
}
                                   // We are passing shipping and billing address with shipping code.                                                        You  can change the address as well as shipping method of your choice

Response :
 
 {
    "payment_methods": [
        {
            "code": "cashondelivery",
            "title": "Cash On Delivery"
        },
        {
            "code": "banktransfer",
            "title": "Bank Transfer Payment"
        },
        {
            "code": "checkmo",
            "title": "Check / Money order"
        }
    ],
    "totals": {
        "grand_total": 27,
        "base_grand_total": 27,
        "subtotal": 32,
        "base_subtotal": 32,
        "discount_amount": -5,
        "base_discount_amount": -5,
        "subtotal_with_discount": 27,
        "base_subtotal_with_discount": 27,
        "shipping_amount": 0,
        "base_shipping_amount": 0,
        "shipping_discount_amount": 0,
        "base_shipping_discount_amount": 0,
        "tax_amount": 0,
        "base_tax_amount": 0,
        "weee_tax_applied_amount": null,
        "shipping_tax_amount": 0,
        "base_shipping_tax_amount": 0,
        "subtotal_incl_tax": 32,
        "shipping_incl_tax": 0,
        "base_shipping_incl_tax": 0,
        "base_currency_code": "USD",
        "quote_currency_code": "USD",
        "items_qty": 1,
        "items": [
            {
                "item_id": 26,
                "price": 32,
                "base_price": 32,
                "qty": 1,
                "row_total": 32,
                "base_row_total": 32,
                "row_total_with_discount": 0,
                "tax_amount": 0,
                "base_tax_amount": 0,
                "tax_percent": 0,
                "discount_amount": 0,
                "base_discount_amount": 0,
                "discount_percent": 0,
                "price_incl_tax": 32,
                "base_price_incl_tax": 32,
                "row_total_incl_tax": 32,
                "base_row_total_incl_tax": 32,
                "options": "[]",
                "weee_tax_applied_amount": null,
                "weee_tax_applied": null,
                "name": "Strive Shoulder Pack"
            }
        ],
        "total_segments": [
            {
                "code": "subtotal",
                "title": "Subtotal",
                "value": 32
            },
            {
                "code": "discount",
                "title": "Discount (You Save)",
                "value": -5
            },
            {
                "code": "shipping",
                "title": "Shipping & Handling (Free Shipping - Free)",
                "value": 0
            },
            {
                "code": "tax",
                "title": "Tax",
                "value": 0,
                "extension_attributes": {
                    "tax_grandtotal_details": []
                }
            },
            {
                "code": "testdiscount",
                "title": "Discount (You Save)",
                "value": -5
            },
            {
                "code": "grand_total",
                "title": "Grand Total",
                "value": 27,
                "area": "footer"
            }
        ]
    }
}                              // return all the available payment methods with cart information

0   0
Eecrets Magento

Related Post

List Your Business

Improve Your Business Visibility

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site