Hi.
How can I update customer's default address using ShopifyAPI gem?
I try this:
customer = ShopifyAPI::Customer.find(params[:shopifyCustomerId]) if customer customer.addresses.each do |address| if address.default address.first_name = params[:firstName] address.save end end
and get - ActiveResource::ClientError: Failed. Response code = 406. Response message = Not Acceptable.
Solved! Go to the solution
Success.
Hey @Illia_Kuzma
You will want to save the customer object versus the address. You can do something like this here:
if customer customer.addresses.each do |address| if address.default == true address.first_name = params[:firstName] customer.save end end
Vix | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
Hi @vix ,
thanks for helping. It is really hard to find info on this.
I just tried what you suggested and get:
ActiveResource::BadRequest: Failed. Response code = 400. Response message = Bad Request.
Hey @Illia_Kuzma
Can you paste your entire code? I can confirm that works while using the Shopify API Console. You may have luck testing there for troubleshooting: https://help.shopify.com/en/api/guides/using-the-api-console
Vix | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
Subject | Author | Latest Post |
---|---|---|
Subject | Author | Posted |
---|---|---|
28m ago | ||
2 hours ago | ||
2 hours ago | ||
2 hours ago | ||
3 hours ago |
User | Count |
---|---|
257 | |
165 | |
134 | |
67 | |
38 |