php-shopify icon indicating copy to clipboard operation
php-shopify copied to clipboard

Add custom post action for batch discount code creation

Open rjacobso opened this issue 5 years ago • 5 comments

PriceRule supports batch discount code creation

https://shopify.dev/docs/admin-api/rest/reference/discounts/discountcode#batch_create-2020-04

rjacobso avatar May 04 '20 16:05 rjacobso

@tareqtms did you not see this or is there a reason you don't want to merge this? Should it be implemented as a new child resource of PriceRule instead? I've used the suggested change to successfully create batch coupon code jobs.

rjacobso avatar May 26 '20 21:05 rjacobso

@rjacobso I see there are 2 merge commits, but cannot see which branch is merged to which and what are the changes.

tareqtms avatar May 26 '20 21:05 tareqtms

@tareqtms

The merge commits were simply to bring my local copy up to date with your recent merges / changes.

The only intended change should be the addition of 3 lines to PriceRule.php as seen here: https://github.com/phpclassic/php-shopify/pull/157/files

rjacobso avatar May 26 '20 21:05 rjacobso

@rjacobso I will review again soon and then merge. Thanks.

tareqtms avatar May 26 '20 21:05 tareqtms

@rjacobso As per the doc, the Batch operation has also option to get info by batch id /admin/api/2020-04/price_rules/{price_rule_id}/batch/{batch_id}.json and also the discount codes /admin/api/2020-04/price_rules/507328175/batch/173232803/discount_codes.json. As the custom post actions work, this will not allow that. Can you please think about it and come up with an idea, otherwise we may screw up the whole batch thing here.

tareqtms avatar Jun 02 '20 05:06 tareqtms