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

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?

Related

How to create 2 unique Headers with complete different navigations on Venture Free Theme of shopify?

I just want to ask the community if you have any idea, how to create a unique header for a specific page on shopify.
Theme is Venture(Free Version)
I want to have UK page and US page on my shopify store. My index page is UK based or international clients. While the US page is for US customers only. I want to have a different header and navigation for US page since there are products that are not available for US customers. I just want to post US only products.
Anyone can help me with this? Thank you!
This will require more than just a header change, but it is possible to have two separate headers.
However, the localization may be tricky.
According to Shopify docs:
Your theme's primary language cannot be a regional variant when using
Shopify Markets. For example, you should not change your primary
language to English (United States). It should be English.
This can be done by assigning an array of IP addresses to an variable that is placed in several conditionals.
This process is far too advanced for laymen. If you are not comfortable with liquid and javscript, You can use Nosto or the app Geo-targeting.
If you are looking to do this yourself, please refer to the docs regarding the ‘browsing_context_suggestions.json’ endpoint.
This will then need to be compared to an array of some sort that will assign your customers to a region.
Then, assign that endpoint to a variable and use that variable as a conditional to display your menu with:
{% assign menu = [british menu] %}
I know how to do this, so if you need help I can set it up. It just won't be free, and I recommend trying the apps before you hire unless you are scaled properly for development.
You will then need to lock your products by region, which is done in ruby. You have limited access to ruby through liquid, and backend editing of this sort requires an app. You cannot region lock products in front end without a ton of work and it will be extremely unstable, expensive, and will not lock search results regionally.
So try Locksmith to region lock products. I haven't used it, so my suggestion is blind there, and some experimentation may be required.

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

BigCommerce - Custom Checkout (Adding Field to Cart)

I am doing some work for a client who uses BigCommerce Stencil Theme and I am pretty new to BC. Until now most of my work with them has been basic theme formatting and styling.
They are asking if I can add checkboxes next to items in cart to indicate an alternative delivery system, and then add a field to address for a hotel room. It seems like built into BC checkout customization you can add fields to addresses so that doesn't seem like an issue, but I'm not so sure about the checkboxes. I would imagine I would need access to the underlying PHP to make this happen which doesn't seem possible. Is this accurate? If not, how might I go about doing this?
I see that I can add the checkboxes themselves to the template files, but as far as sending any data with the checkout I don't know how I'd go about doing this.
For the hotel room address field, you are correct that the simplest solution would be to use the built-in custom address field feature.
For the checkbox/alternate delivery system, we're close to releasing a new Checkout JS SDK that will give you the ability to create a completely custom checkout experience. The SDK is basically a Javascript wrapper for our Storefront Checkout API and it includes operations for checkout actions (like creating a new shipping consignment for an alternate delivery method).
The Checkout SDK doesn't give you access to the underlying PHP; instead, it allows you to create your own frontend using React or whatever framework you prefer. The logic for custom checkout steps would exist in your frontend, and you would send your data to the checkout via the BC Checkout API.
https://stencil.bigcommerce.com/docs/customizing-checkout

BigCommerce user defined custom fields for address and customer

I need to retrieve custom field values for customers and addresses using the Big Commerce API.
There appears to be a facility for this for custom product fields;
https://developer.bigcommerce.com/api/stores/v2/products/custom_fields
However no documentation exists for customers and addresses. I tried to access with a similar URL to the products custom fields URL (ie. GET /stores/{store_hash}/v2/customers/{customer_id}/custom_fields) with no success
I realise a similair question has been asked on here already, however BigCommerce support asked me to ask the question on here and that a developer will respond. Here's hoping.
Unfortunately there is no endpoint for custom fields on customers/addresses through the BC API. Hopefully that will be something they'll add when they come out with the next version of their API

Shopify API: Create a Promotion?

Using the Shopify API, is there a way to creation promotions for your store? If not, is there a way to programmatically create promotions in Shopify? (short of using CURL posts to the admin)
That is, I can create a promotion by hand using the admin and navigating to the Promotions and clicking the Add a discount code link. I'd like to be able to do the same thing programmatically, or to know for certain this isn't possible. I don't see any obvious method on the api list, but it seems like something should be an API method.
Unfortunately they don't allow it... I resorted to creating an interface to do so, though:
https://github.com/MartinAmps/Shopify-Private-APIs
Hope it helps
Edit
I also created a blog post about it.
There is no way to create discounts via the API.
If you want we have made an application that can be used to create discount codes.
Otherwise you can use a tool like Mechanize to automate coupon creation for you, but keep in mind theres a good chance that any time in the future it will break since we don't make any promises to keep our admin the same in the future. Any changes have a good chance of breaking whatever script you'd end up writing.
The Price Rules API is now public and allow any app to create price rules and discount codes.
https://help.shopify.com/api/price-rules
If you're familiar with Rails or you're already using ActiveResource for your Shopify API calls, then you can drop in this modified version of Discount < ActiveResource::Base https://gist.github.com/choonkeat/09a56da222f506e627c5