Shopify API: Create a Promotion?

2020-02-10 04:59发布

问题:

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.

回答1:

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.



回答2:

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.



回答3:

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



回答4:

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



标签: shopify