gptinker / laravel-google-merchant
A sample Laravel package to manage products on Google merchant center
1.4
2024-12-13 06:06 UTC
README
Installation
composer require gptinker/google-merchant
Setup
1. Add Variable given below to .env file
GOOGLE_MERCHANT_ID="1234567890" GOOGLE_MERCHANT_TARGET_COUNTRY="AE" GOOGLE_MERCHANT_CONTENT_LANGUAGE="en" GOOGLE_MERCHANT_CHANNEL="online"
2. Store your credentials JSON file in storage/json folder named google-merchant-credentials.json
storage/json/google-merchant-credentials.json
Usage
use Gptinker\GoogleMerchant\Facades\ProductApi;
1. Fetch Products
$response = ProductApi::fetch(); if($response['status'] == 'success'){ // Success }else{ // Error }
2. Insert Product
The request body contains an instance of Product
$response = ProductApi::insert($product); if($response['status'] == 'success'){ // Success }else{ // Error }
3. Get Product
$product_id = Same id used in "offerId" while insertion
$response = ProductApi::get($product_id); if($response['status'] == 'success'){ // Found }else{ // Not Found }
4. Update Product
The request body contains an instance of Product
$product_id = Same id used in "offerId" while insertion
$response = ProductApi::update($product, $product_id); if($response['status'] == 'success'){ // Success }else{ // Error }
5. Delete Product
$product_id = Same id used in "offerId" while insertion
$response = ProductApi::delete($product_id); if($response['status'] == 'success'){ // Success }else{ // Error }