Hello Laravel Friends,
In today’s blog file, I will discuss How to Add File in Shopify Store using Laravel.
We sometimes have to add a theme file in our Shopify store to perform any action in the front store. We can add file in the theme by theme id. Get Active Theme ID of Shopify Store.
We have used osiset/laravel-shopify addon to add file to the Shopify store.
Step 1: Integrate osiset/laravel-shopify addon with your Shopify app.
Note: You can add file in the theme either from the controller or from the view file (blade file).
Step 2: If you are adding file from the controller, then add the following class in your controller file after namespace
use Illuminate\Support\Facades\Auth;
Step 3: Use the following code in php file to add file in theme by theme id:
$data = file_get_contents(storage_path('your path)); $param = [ 'asset'=>[ 'key'=>'snippets/filename.liquid', 'value'=>$data ] ]; $this->shop->request('put','themes/{theme_id}/assets.json',$param);
Note – The above code will add the file to the snippet folder, but you can also change it as per your requirement.
Accordingly, you can Add File in Shopify Store using Laravel. If you have any doubts, connect with me through the comment section. Share the tutorial with your other Shopify developer friends and stay in the know so that you do not miss any updates from us.
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.…