All Projects → bold-commerce → bold-shopify-toolkit

bold-commerce / bold-shopify-toolkit

Licence: Apache-2.0 license
A Symfony Based Shopify api wrapper

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to bold-shopify-toolkit

shopify-development-resources
A List of resources for Shopify development
Stars: ✭ 56 (+133.33%)
Mutual labels:  shopify, shopify-api
oauth2-shopify-php
Shopify Provider for the OAuth 2.0 Client
Stars: ✭ 14 (-41.67%)
Mutual labels:  shopify, shopify-api
shopapp-shopify-ios
A Shopify provider for a ShopApp for iOS application
Stars: ✭ 49 (+104.17%)
Mutual labels:  shopify, shopify-api
shopify-graphql-elixir
Elixir client for the Shopify GraphQL Admin API
Stars: ✭ 18 (-25%)
Mutual labels:  shopify, shopify-api
mechanic-tasks
Public task repository for Mechanic (https://mechanic.dev)
Stars: ✭ 42 (+75%)
Mutual labels:  shopify, shopify-api
shopify-node-express-app
Simple Shopify app with Express and Node.js that connects to a Shopify store via OAuth.
Stars: ✭ 20 (-16.67%)
Mutual labels:  shopify, shopify-api
shopify-node-react-app
Shopify paid app in Node.js & React.js that connects to a store and lets merchants select products to automatically discount them in the Shopify admin interface.
Stars: ✭ 29 (+20.83%)
Mutual labels:  shopify, shopify-api
shopify-app-starter-kit
Shopify app starter kit written in Ruby on Rails w/ appropriate tools to get your Shopify app up and running quickly 🚀
Stars: ✭ 42 (+75%)
Mutual labels:  shopify, shopify-api
next-shopify-starter
Nextjs + Tailwind CSS + Shopify Starter
Stars: ✭ 385 (+1504.17%)
Mutual labels:  shopify, shopify-api
shopify-next.js-tailwind
Learn the Shopify + Next.js + Tailwind CSS Stack! SWR, Hydrogen, + more
Stars: ✭ 227 (+845.83%)
Mutual labels:  shopify, shopify-api
shopify-wishlist
💙 A set of files used to implement a simple customer wishlist on a Shopify store
Stars: ✭ 115 (+379.17%)
Mutual labels:  shopify
richer
jquery free ajax cart for shopify
Stars: ✭ 35 (+45.83%)
Mutual labels:  shopify
polaris-vue
Polaris Vue by HulkApps is a component library for Vue.js based on Shopify Polaris style guide.
Stars: ✭ 39 (+62.5%)
Mutual labels:  shopify
gulp-shopify-theme
Shopify theme synchronisation during development
Stars: ✭ 26 (+8.33%)
Mutual labels:  shopify
shopify-node-app-starter
🚀🚀 A Shopify embedded app starter template, written in TypeScript with session storage, app context and examples for basic functionalities.
Stars: ✭ 99 (+312.5%)
Mutual labels:  shopify
gulp-shopify
Blank slate Shopify theme for Developers, packaged with Gulp.js for processing SCSS, JavaScript (ES6), images and fonts. Made to support Online Store 2.0 features and Shopify CLI.
Stars: ✭ 142 (+491.67%)
Mutual labels:  shopify
vscode-liquid
💧Liquid language support for VS Code
Stars: ✭ 137 (+470.83%)
Mutual labels:  shopify
nextjs-shopify
This repository contains the app without webhook for the Build a Shopify app with Node and React tutorial.
Stars: ✭ 56 (+133.33%)
Mutual labels:  shopify
MugglePay
Make Crypto Payment Easy 让数字货币支付更简单
Stars: ✭ 176 (+633.33%)
Mutual labels:  shopify
bootstrap-shopify-theme
🛍 A free Shopify Theme built with Bootstrap, BEM, Liquid, Sass, ESNext, Theme Tools, ... and Webpack.
Stars: ✭ 41 (+70.83%)
Mutual labels:  shopify

Bold Shopify Toolkit

CircleCI

Purpose

Bold Shopify Toolkit is a Symfony-based Shopify wrapper that makes it easy to interact with Shopify. The intention is to integrate with the API offered by Shopify and maintain consistent data structures for the models and services that access these endpoints.

Getting Started

This package works best with a Dependency Injection Container since there are many dependencies that need to be resolved.

Prerequisites

To use this package, you will need to bind Models to the following interfaces.

An example API Sleeper has been included in this package.

Laravel: (see AppServiceProvider.php)

    $this->app->bind(\BoldApps\ShopifyToolkit\Contracts\ApiSleeper::class,
            \BoldApps\ShopifyToolkit\Support\ShopifyApiHandler::class);

Installing

Add to composer.json

$ composer require bold-commerce/bold-shopify-toolkit

Bind the appropriate models during your request lifecycle.

    $this->app->bind(\BoldApps\ShopifyToolkit\Contracts\ApiSleeper::class,
            \BoldApps\ShopifyToolkit\Support\ShopifyApiHandler::class);

    ...

Bind the shop that will be using the toolkit before making calls to its services and/or models.

// $shop - Eloquent model containing at least the myshopify_domain ("example.myshopify.com")
app()->instance(BoldApps\ShopifyToolkit\Contracts\ShopBaseInfo::class, $shop);
 
// $accessToken - Contains the access token string created when the shop installed the app
app()->instance(BoldApps\ShopifyToolkit\Contracts\ShopAccessInfo::class, $accessToken);

Running the tests

$ vendor/bin/phpunit tests

There is a dockerfile provided for running the tests the same way it will run on Circle

$ ./runtests.sh

Examples

Create the service representing the API you would like to use:

$variantService = new BoldApps\ShopifyToolkit\Services\Variant();
//OR
$variantService = app()->make(BoldApps\ShopifyToolkit\Services\Variant::class);

Get a single variant model:

/** @var BoldApps\ShopifyToolkit\Models\Variant $variant */
$variant = $variantService->getById(2641814487051);
 
$variant->getPrice(); //99.0

Get a collection of variant models and filter it so that we only get their titles, using the product ID:

/** @var Illuminate\Support\Collection $variants */
$variants = $variantService->getAllByProductId(327661486091, ["fields" => "title"]);
 
/** @var BoldApps\ShopifyToolkit\Models\Variant $variant */
foreach ($variants as $variant) {
    $title = $variant->getTitle(); //"Default title"
}

Update a variant:

$variant->setOption1("Not pink");
 
$updatedVariant = $variantService->update($variant);
 
$updatedVariant->getOption1(); //"Not pink"

See tests/VariantTest.php for an example of how to serialize and deserialize a model.

TODO

  • Add more tests

Contributing

Pull requests and ideas are welcome! Open an issue and lets talk.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache 2 License - see the LICENSE.md file for details

Acknowledgments

  • Thanks to Shopify for making the best Developer Network!
  • Thanks to Bold Commerce Developers for making this amazing package
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].