Skip to content

Create/Update Commerce API documentation with Axios examples #117

Description

@Stalex89

What are you trying to do?
I have a project which uses decoupled frontend on Nuxt.js and headless Craft as backend/api.
My task is to implement cart logic on the frontend (get cart, add items, remove items, checkout procedure etc.), so I have to use GraphQL/axios calls.
However I find it a little bit challenging to implement all Axios calls for cart, as currently GraphQL supports only product/variant, but not cart/order/checkout; And there are no examples of handling Commerce API with Axios on decoupled frontend (only twig template code examples) in documentation.

What's your proposed solution?
It would be really great to have documentation with the way of handling API with Axios independently from twig code
(with available methods, query parameters, body parameters etc.), at least until Commerce is fully manageable by GraphQL

Activity

  1. changed the title [-]Update Commerce documentation with Axios API examples[/-] [+]Crate/Update Commerce API documentation with Axios examples[/+] on Dec 11, 2020
  2. changed the title [-]Crate/Update Commerce API documentation with Axios examples[/-] [+]Create/Update Commerce API documentation with Axios examples[/+] on Dec 11, 2020
  3. mattstein commented on Feb 25, 2021

    @mattstein
    Contributor

    Hey @Stalex89, we’ve got a Controller Actions page for the Commerce documentation that’ll be launching alongside Commerce 3.3. It’s modeled after Craft’s own Controller Actions page and it should help in this case. Take a peek here if you’d like: https://github.com/craftcms/docs/blob/next/commerce/docs/commerce/3.x/dev/controller-actions.md

    There aren’t Axios-specific examples, but that would look similar to the jQuery example here: https://craftcms.com/docs/commerce/3.x/orders-carts.html#fetching-a-cart

  4. Stalex89 commented on Feb 25, 2021

    @Stalex89
    Author

    Hi @mattstein, thank you very much for the information, I will check it 😃

  5. mattstein commented on Feb 25, 2021

    @mattstein
    Contributor

    Also snuck in an Axios example here just for good measure: https://craftcms.com/docs/commerce/3.x/orders-carts.html#fetching-a-cart

    🤫

  6. locked and limited conversation to collaborators on Dec 21, 2021
  7. converted this issue into a discussion #307 on Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    💳 CommerceCraft Commerce content related issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions