1

i'm writing on behalf of our client MOEBE.

Our developer has a problem with the way Roomle use the shortID which is used to add the items into the cart. He says that we need to change the shortID from SKU to product variant ID. Shopify doesn’t allow the cart API to use SKU to add items in the basket.

Alternative if we can get access to the backend in Roomle, then he will be able to create a map between the SKU and variant ID.

  • 1
    Do you use the Shopify REST Admin API for that? – Tahir Alvi Mar 08 '21 at 13:25
  • 1
    Currently I do not fully understand how the Roomle backend could help you. When the user finishes configuration the event onRequestProduct is fired. You will get the configurationId (which is unique for every configuration, so you can create the map based on this ID as well). You also get the part list with all articles and their parameter settings. Let us know what is still missing to integrate seamlessly into Shopify – tschoartschi Mar 12 '21 at 08:34

1 Answers1

1

Sadly shopify do not allow using SKU codes using Ajax API.

If you modify the process of adding to the cart You probably need use some try and error run.

The very fact of adding a product to the cart can be largely solved by extending the JS code on the product page.

I suggest listing the variants of the product to the variable in the liquid template and using an additional script to handle adding to the cart. It might look dirty, but it will work.

<script type="text/javascript">
    var product= `{{ product | json }}`; //Whole product variable
    var variant_id = {{ product.variants[0].id }}; //First product variant id
</script>

Do you have one variant per product or more?

Tomasz Ferfecki
  • 1,263
  • 14
  • 22
  • Hi, you're talking about using the configurator on the product page, but in our case we are using it to create a list of products based on the product the customer creates. Please take a look into: https://dezql4coy0el5cmm-48549626019.shopifypreview.com/pages/configurator?_pos=1&_psq=conf&_ss=e&_v=1.0 – Magnus Gravenhorst Mar 08 '21 at 20:25
  • Option 1 If you don't have invidual parts created in shopify create it. (example moebe:ShelfSystem_EndCaps) All your product is in `configuration.parts` variable. You should try edit configurations in roomble. Add to that parts parameter containing variant id. With that variant id you can later add every item to basket. that will make final product from it. Option 2 In other way you can add generic product named as your part and in `properties` insert configuration id "moebe:ShelfSystem_StartingSpace:06A79A[...]" – Tomasz Ferfecki Mar 09 '21 at 07:35
  • Why is it sad that you cannot add a product by SKU to a cart? SKU is nothing but a string, and every single product in a shop can share a single SKU string. So if you imagine that being your starting point, you're in for a world of hurt. Hence, use a distinct value, like variant ID, that actually represents the SKU accurately. It is not a challenge to alter programming to use correct values. – David Lazar Mar 10 '21 at 03:41
  • @DavidLazar Shopify do not handle well sku in orders. If you create order with sku instead variant_id over Rest API you will end up with not mapped product in order. But this is different story not relevant to question. – Tomasz Ferfecki Mar 10 '21 at 07:36
  • You'd have to define "Do not handle well". There is just no context for such a broad statement. A SKU is an identifier for a product variant in Shopify. How that presents any problems for anyone is a total mystery. – David Lazar Mar 10 '21 at 15:55
  • When you creating order via Rest with sku, you can pass anything you want (as long as you enter, sku, title, quantity and price) There is no validation and resolving sku to variant_id during creation of order. It will create order which is nice and dandy, but forget about product inventory management – Tomasz Ferfecki Mar 11 '21 at 07:40