Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To set scopes for your Shopify app developed with Laravel, you need to:

  1. Update the app's config/shopify-app.php file to include the required scope. For example, to include the write_price_rules scope, add the following line of code to the scopes array:

'write_price_rules',

  1. Then, you must update the app's config/shopify-auth.php file to include the scope within the options array. For example,
'options' => [
    'grant_options' => [
        'write_price_rules',
    ],
],
  1. Lastly, update your app's routes/web.php or routes/api.php file to include the specific route that requires the write_price_rules scope, and then add a middleware to check that the authenticated user has the required scope. For example,
Route::post('/create-price-rule', 'PriceRuleController@store')->middleware(['auth.shop', 'scopes:write_price_rules']);

Once you have made these updates, you should submit your app for merchant approval, and ensure that the write_price_rules scope is clearly explained and justified in your app's documentation and usage instructions.