Comments (11)
Looks like we need to overload the save method to update the prefix_options with the product id:
https://github.com/drwelby/shopify_python_api/blob/master/shopify/resources.py#L115-L117
from shopify_python_api.
Also a Product.add_variant(variant) seems handy:
https://github.com/drwelby/shopify_python_api/blob/master/shopify/resources.py#L106-L108
from shopify_python_api.
hi there, thanks for opening an issue. I took a look and the way you want to do this is like so
v = shopify.Variant({'product_id':632910392})
I realize this isn't super intuitive but I hope this solves your problem
from shopify_python_api.
Isn't that the same thing as
v = shopify.Variant()
v.product_id = 632910392
Since in the one-liner you're setting the attribute via pyactiveresource's _update, and in the two-liner via setattr ?
There's been updates to both the python api and pyactiveresource since I filed the pull request, so maybe it's working now anyway? I'll give it a try.
from shopify_python_api.
I would have thought so but it didn't work for me.
from shopify_python_api.
Seems like the dict you're passing is getting used as prefix_options (where it's needed) and not as the variant's attributes (which is the more intuitive action). No idea why, though.
def __init__(self, attributes=None, prefix_options=None):
( https://github.com/Shopify/pyactiveresource/blob/master/pyactiveresource/activeresource.py#L351)
from shopify_python_api.
yeah that is weird. We're planning to move away from activeresource and pyactiveresource for api libraries eventually.
from shopify_python_api.
I'll poke around with it more this weekend, but it seems like this would let it work either way:
https://github.com/drwelby/shopify_python_api/blob/master/shopify/resources.py#L119-L122
from shopify_python_api.
That looks like it might be the fix, feel free to make a PR after you play around with it a bit
from shopify_python_api.
How are you running your unittests? I want to add some additional coverage for my changes but I can't get them to run the way I usually do.
from shopify_python_api.
you can run the tests with
python setup.py test
from shopify_python_api.
Related Issues (20)
- When is 2023-7 api version releasing HOT 6
- pyactiveresource.connection.Error: Not Found: fulfillments.json when creating fulfillment HOT 5
- Add support to AssignedFulfillmentOrder HOT 2
- Running into certificate issue with python 3.12 HOT 3
- A new release of the Shopify API is due soon HOT 2
- Test failure for `test_raises_if_aud_doesnt_match_api_key` HOT 2
- A new release of the Shopify API occurred
- API Version is not working greater then 2023-04 HOT 12
- Deprecation Notice for `gateway` Field in Order Object - Impact on Shopify Python SDK HOT 2
- Package Version 12.4.0 shows released in CHANGELOG but not available in PyPi HOT 4
- 413 (Payload Too Large) while uploading images under 2Mb HOT 2
- Add promised online access token support HOT 2
- Allow to interact console with ipython
- Global state for sessions causes race conditions on async code HOT 2
- A new release of the Shopify API is due soon HOT 2
- I cannot find the abandoned checkouts endopoint HOT 5
- Shopify Python SDK Deletes Customer Address on Same Address Update HOT 4
- A new release of the Shopify API occurred HOT 2
- request online access token HOT 2
- `calculated_refund` Appears as `None` when Printed but is Not Actually `None` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shopify_python_api.