How can I retrieve Shopify products via the REST API in a specific language without being admin? - shopify

Imagine a route on a Shopify shop like this: https://shopifyshop.com/products/some-product?lang=en - then I can access the product as JSON like this: https://shopifyshop.com/products/some-product.json?lang=en
However the main issue is that then the ?lang parameter is not respected. How can I have it respect the language parameter?

If the shop has the multiple languages enabled you can use the language code in the url like, example for Japanese:
shopifyshop.com/ja/products/some-product.json

Related

Shopify Storefront - How to create a customer with a local context?

I have difficulties creating a customer the way I want.
The store has German as the base language, and English, France and Spanish as other supported languages.
When I create a customer with the storefront graphql API, it will always have german as the language used for the notification emails.
So what I tried already:
Use the #inContext(locale: Fr) -Syntax
Make use of accept-language and content-language http headers
What I tried as well, was to update the customer entity by using the admin-grapqhl API. Even though this worked as expected, the first welcome mail will still be sent in german, since I can only update the customer after it was created.
I cannnot create the customer by the admin API as well, because I would loose the option for the user so set a password.
It's quite unimaginable that this is not covered by the storefront API somehow, so does anyone has a clue on how to archive this?

Ebay developer API function get_item_aspects_for_category returns only English content

I'm working on eBay Developer API with addItem method, that requires to make an additional call for category aspects by given category ID. My marketplace is Germany and addItem requires me to send aspects with German language but eBay get_item_aspects_for_category returns only English values. I'm sending Accept-Language header as de-DE and X-EBAY-C-MARKETPLACE-ID as EBAY_DE for sure.
What im doing wrong?
For example i have a category id 258017, that returns something like that:
{"aspects":[{"localizedAspectName":"Brand","aspectConstraint":{"aspectDataType":"STRING","itemToAspectCardinality":"SINGLE","aspectMode":"FREE_TEXT","aspectRequired":true,"aspectUsage":"RECOMMENDED","aspectEnabledForVariations":false,"aspectApplicableTo":["PRODUCT"]},"aspectValues":[{"localizedValue":"Unbranded"},{"localizedValue":"+ONE"},{"localizedValue":"10 Strawberry Street"}]}
UPD. Yes (not recommended), content returns in English, but eBay Developer API has Translation API with translate method that works with Deutsch (German) language also and its possible to translate some strings there and then send it to API.
UPD2. Finally Solved. getItemAspectsForCategory has an URI Parameter named category_tree_id that in real is Ebay Site ID of needle MarketPlace. But in docs description of this field doesnt follow site id implementation.
For example, endpoint for EBAY_DE (site id 77) for category 258017 has to be:
https://api.ebay.com/commerce/taxonomy/v1/category_tree/77/get_item_aspects_for_category?category_id=258017

Shopify custom forms using liquid

I would like customers to complete a custom survey so we can gauge which product is most right for them.
My idea is to use a form to collect the customers answers and run a function to determine the product they need.
Is this possible using a shopify theme?
I am very confused on integrating custom logic into a theme
If the logic for the survey is written in Javascript and the function that determines the product is written in Javascript it will be possible.
To be more precise if you don't use the Shopify forms logic, but custom code everything it will be possible but it will require a lot of configuration depending of the survey length.
But things like sending a custom email to the customers or something in those line will not be possible with Shopify (only if you use a third party App for custom forms logic).

Getting current Product ID with Shopify API for a Javascript API call

I'm toying with developing a Shopify App that uses the DaisyAPI dynamic image service for Shopify. In order to make the correct call to the Daisy API, I need to know what Product the customer is looking at. It seems like, to reliably do that, I will need to manipulate their product.liquid theme to insert a hidden value containing the Product ID so that Jquery can pick up that value and insert it into the API call.
What's the best way to ensure every product page contains the product ID in such a way jQuery can reliably find it? Am I overlooking something obvious?
Many thanks!
Another option would be to use the Ajax API to request the product. Of you know you're on a product page simple make a request to the same URL and append .json. You will then have a json representation of the product that you can do whatever yo want with.
To get you js into the theme you can use a script tag which will load js from you server onto the shop.
You are missing a very obvious and cool Liquid filter.
In Liquid, pump the Object for it's JSON.
var p = {{ product | json }};
And then go to town... you cannot go far on the client without this concept. Get the JSON man.. get the JSON...

Modify fulfillment.tracking_url variable?

As part of a Shopify app I'm building, I'd like to modify the fulfillment.tracking_url email variable.
Specifically, when a customer is emailed their tracking number, I want to change the tracking URL from the default carrier so that ALL tracking links are this format:
http://example-store.myshopify.com/tools/track?n=1Z18E08VYW76416035
Is that possible?
This currently isn't possible, but it's something Shopify is thinking of making available. We will let you know once it's out via an upcoming Shopify Developer newsletter and over #shopifyapi.