Hello Shopify Friends,
Today I am going to explain How to Get the Active Theme ID of the Shopify Store in the Shopify-Laravel App.
It sometimes happens that we require the currently activated theme ID of your Shopify store to perform some action.
So here is the solution to get active theme data. We have used the osiset/laravel-shopify addon to get theme data. Also checkout the latest Shopify editions with 100+ new products and updates.
Step 1: Integrate osiset/laravel-shopify addon with your Shopify app.
Check – How to Integrate Shopify App with Laravel
Step 2: Visit the below file path.
app\Models\User.php
Use the following code in the User Model file
public function getActiveThemeId() { $active_theme_id = 0; $themes=$this->api()->rest('get','/admin/api/2021-07/themes.json'); $themes=$themes['body']['container']['themes']; foreach($themes as $theme) { if($theme['role']=="main") { $active_theme_id=$theme['id']; } } return $active_theme_id; }
Note: You can use getActiveThemeId() function anywhere using user object
Accordingly, you can retrieve the ID of the active theme on your Shopify website. If you face any difficulty in getting a theme ID, our Shopify Professional Developers can help you out. Mention the error in the comment box.
Happy Coding!
In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…
In the world of business, understanding financial metrics is crucial for making informed decisions and…
Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…
In this era, businesses are always on the lookout for ways to engage with their…
Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…