Closed ClaytonPassmore closed 3 months ago
Hi @ClaytonPassmore, thank you for opening an issue with this level of detail! I'm going to add it to our internal workflow.
Awesome, thank you @matteodepalo 🙏
Thanks for providing the failing test, that was super helpful in fixing this!
Happy to help @paulomarg! Looking forward to seeing the fix merged 🥳
Issue summary
Before opening this issue, I have:
shopify_api
version: 2024-01log_level: :debug
in my configuration, if applicableWhen updating a customer's email marketing consent state, the Shopify API seems to require both the
state
andopt_in_level
. However, if theopt_in_level
does not change, the gem does not send up theopt_in_level
part of the hash, which results in a 422.Aside: The process of updating a customer's email marketing consent is not well documented. The official REST docs have an example titled "update a customer's marketing opt-in state" but it uses the old, deprecated parameters.
Expected behavior
The gem should send up all required parameters, regardless of whether or not they change.
Actual behavior
The gem only sends up fields that change, this makes it impossible to update a customer's email marketing consent state when the opt-in level doesn't change.
Steps to reproduce the problem
email_marketing_consent
field that contains all the same attributes, but a differentstate
(e.g. use "subscribed" if the customer was not subscribed)Alternatively, try adding these tests to the
test/rest/2024_01/customer_test.rb
file.The first test is a "control" to ensure the test works as expected when the opt-in level changes. This test should pass.
The second test is the same as the first, the only difference is that the opt-in level stays the same. This test currently fails (but should pass when the bug gets fixed).
Debug logs