Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Morten Dahl Pedersen 3 posts 43 karma points
    Sep 10, 2024 @ 10:02
    Morten Dahl Pedersen
    0

    Problems setting up headless Umbraco Commerce - Storefront API

    Greetings, Umbraco community!

    I'm implementing a website headlessly and have run into some issues with Umbraco Commerce. Here's my situation:

    1. We've successfully used the Content Delivery API to fetch content from Umbraco's backend.
    2. Now, I'm trying to implement Umbraco Commerce on the same site, but I'm encountering problems when creating orders.

    The Issue

    I'm uncertain how to pass products to the API correctly. According to Swagger, the request body should look like this:

    json { "productReference": "string", "productVariantReference": "string", "quantity": 0, "properties": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "bundleId": "string" }

    However, for the products in my content tree, I've only added: - SKU (a text string) - Price (Umbraco.Commerce.Price)

    When I provide just these details, I get an error: "Value cannot be null. (Parameter 'productSnapshot')"

    Questions

    1. How do I correctly pass product information to the API?
    2. I've found mentions of "product adapters" while googling. How do these work with the API?
    3. Is there any additional setup required for headless commerce that I might be missing?

    I'm quite new to Umbraco Commerce, so any guidance or resources would be greatly appreciated. Thanks in advance for your help!

  • Morten Dahl Pedersen 3 posts 43 karma points
    Sep 10, 2024 @ 13:15
    Morten Dahl Pedersen
    100

    So the issue was simply that i passed the SKU as productReference. What i needed to pass was the products ID, which is a guid.

Please Sign in or register to post replies

Write your reply to:

Draft