Liquid, JavaScript, themes, sales channels
I am using Laravel and kyon147/laravel-shopify package to create an app. When I wanted to create a liquid file through asset API, I got the below error. Let me know what is wrong.
"exception" Client error: `PUT my-shop-domain/admin/api/2023-10/themes/161834598681/assets.json` resulted in a `404 Not Found`
Controller Method:
public function index() { /** @var IShopModel $shop*/ $shop = Auth::user(); $themes = $shop->api()->rest('GET', '/admin/api/2023-10/themes.json'); $activeThemeId = ''; foreach ($themes['body']['themes'] as $theme) { if ($theme['role'] === 'main') { $activeThemeId = $theme['id']; } } if ($activeThemeId) { $content = "test content"; $liquidFile = [ 'asset' => [ 'key' => 'templates/out-of-stock.liquid', 'value' => "test content" ] ]; $response = $shop->api()->rest('PUT', '/admin/api/2023-10/themes/' . $activeThemeId . '/assets.json', $liquidFile); dd($response); } }
I have the exact same issue right now.
User | RANK |
---|---|
38 | |
28 | |
13 | |
11 | |
8 |
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023