Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more combination examples #55

Open
seb86 opened this issue Sep 27, 2021 · 0 comments
Open

Add more combination examples #55

seb86 opened this issue Sep 27, 2021 · 0 comments
Assignees
Labels
example Examples that need adding or tweaking in the documentation

Comments

@seb86
Copy link
Member

seb86 commented Sep 27, 2021

For example adding a variation with custom item data.

var data = {
  "id": "1820",
  "quantity": "1",
  "variation": {
    "attribute_colours": "Red",
    "attribute_pa_size": "2x-large"
  },
  "item_data": {
    "engraved_name": "Sébastien Dumont",
    "engraved_size": "Medium"
  }
};

CoCart.post("cart/add-item", data)
.then((response) => {
  // Successful request
  console.log("Response Status:", response.status);
  console.log("Response Headers:", response.headers);
  console.log("Response Data:", response.data);
})
.catch((error) => {
  // Invalid request, for 4xx and 5xx statuses
  console.log("Response Status:", error.response.status);
  console.log("Response Headers:", error.response.headers);
  console.log("Response Data:", error.response.data);
})
.finally(() => {
  // Always executed.
});
@seb86 seb86 added the example Examples that need adding or tweaking in the documentation label Sep 27, 2021
@seb86 seb86 self-assigned this Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example Examples that need adding or tweaking in the documentation
Development

No branches or pull requests

1 participant