[Special Summer Sale] 40% OFF All Magento 2 Themes

Cart

Shopify API: Create a Promotion?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #9238
    David Hoang
    Keymaster

    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.

    #9241
    David Hoang
    Keymaster

    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.

    #9242
    David Hoang
    Keymaster

    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.

    #9239
    David Hoang
    Keymaster

    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

    #9240
    David Hoang
    Keymaster

    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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.