Skip to content

Commit 49ac028

Browse files
committed
Merge branch '4.0' into feature/user-package-retries
# Conflicts: # CHANGELOG.md
2 parents 4c0f2e9 + 828e0d7 commit 49ac028

File tree

9 files changed

+67
-53
lines changed

9 files changed

+67
-53
lines changed

CHANGELOG.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Release Notes for Shopify
22

3-
### Unreleased
4-
3+
## 4.0.0 - WIP
4+
- Shopify now requires `shopify/shopify-api` 5.2.0 or later.
5+
- Shopify now the related custom app to be created with event version set to `2023-10`.
56
- Syncing meta fields is no longer performed in a job.
6-
- Fixed a bug where the template routing setting would not save.
77
- Deprecated the `craft\shopify\jobs\UpdateProductMetadata` job.
8+
- Fixed a bug where the template routing setting would not save.
89

910
## 3.2.0 - 2023-06-12
1011

README.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ Before upgrading ensure that the **Admin API access scopes** match the [requirem
4242

4343
After upgrading, ensure that all required webhooks have been created by clicking the “Create” button on the **Shopify** → **Webhooks** screen in your project’s control panel page in the CP. If the “Create” button is not visible, all required webhooks have been created.
4444

45+
#### From `3.x` to `4.x`
46+
47+
In version `4.0.0` the plugin changed its Shopify API requirement to version `2023-10`. Any Shopify custom apps created before this version will need to update their webhook event version to `2023-10`.
48+
49+
This can be done by visiting your Shopify store and going to **Settings** → **Apps and sales channels** → **Develop apps** clicking you app and then **Configuration** → **Webhook version**.
50+
4551
### Create a Shopify App
4652

4753
The plugin works with Shopify’s [Custom Apps](https://help.shopify.com/en/manual/apps/custom-apps) system.
@@ -58,7 +64,7 @@ Follow [Shopify’s directions](https://help.shopify.com/en/manual/apps/custom-a
5864
- `read_product_listings`
5965
- `read_inventory`
6066

61-
Additionally (at the bottom of this screen), the **Webhook subscriptions** → **Event version** should be `2022-10`.
67+
Additionally (at the bottom of this screen), the **Webhook subscriptions** → **Event version** should be `2023-10`.
6268

6369
3. **Admin API access token**: Reveal and copy this value into your `.env` file, as `SHOPIFY_ADMIN_ACCESS_TOKEN`.
6470
4. **API key and secret key**: Reveal and/or copy the **API key** and **API secret key** into your `.env` under `SHOPIFY_API_KEY` and `SHOPIFY_API_SECRET_KEY`, respectively.
@@ -124,7 +130,7 @@ Once the plugin has been configured, perform an initial synchronization via the
124130
125131
### Native Attributes
126132

127-
In addition to the standard element attributes like `id`, `title`, and `status`, each Shopify product element contains the following mappings to its canonical [Shopify Product resource](https://shopify.dev/api/admin-rest/2022-10/resources/product#resource-object):
133+
In addition to the standard element attributes like `id`, `title`, and `status`, each Shopify product element contains the following mappings to its canonical [Shopify Product resource](https://shopify.dev/api/admin-rest/2023-10/resources/product#resource-object):
128134

129135
| Attribute | Description | Type |
130136
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
@@ -137,8 +143,8 @@ In addition to the standard element attributes like `id`, `title`, and `status`,
137143
| `tags` | Tags associated with the product in Shopify. | `Array` |
138144
| `templateSuffix` | [Liquid template suffix](https://shopify.dev/themes/architecture/templates#name-structure) used for the product page in Shopify. | `String` |
139145
| `vendor` | Vendor of the product. | `String` |
140-
| `metaFields` | [Metafields](https://shopify.dev/api/admin-rest/2022-10/resources/metafield#resource-object) associated with the product. | `Array` |
141-
| `images` | Images attached to the product in Shopify. The complete [Product Image resources](https://shopify.dev/api/admin-rest/2022-10/resources/product-image#resource-object) are stored in Craft. | `Array` |
146+
| `metaFields` | [Metafields](https://shopify.dev/api/admin-rest/2023-10/resources/metafield#resource-object) associated with the product. | `Array` |
147+
| `images` | Images attached to the product in Shopify. The complete [Product Image resources](https://shopify.dev/api/admin-rest/2023-10/resources/product-image#resource-object) are stored in Craft. | `Array` |
142148
| `options` | Product options, as configured in Shopify. Each option has a `name`, `position`, and an array of `values`. | `Array` |
143149
| `createdAt` | When the product was created in your Shopify store. | `DateTime` |
144150
| `publishedAt` | When the product was published in your Shopify store. | `DateTime` |
@@ -147,7 +153,7 @@ In addition to the standard element attributes like `id`, `title`, and `status`,
147153
All of these properties are available when working with a product element [in your templates](#templating).
148154

149155
> **Note**
150-
> See the Shopify documentation on the [product resource](https://shopify.dev/api/admin-rest/2022-10/resources/product#resource-object) for more information about what kinds of values to expect from these properties.
156+
> See the Shopify documentation on the [product resource](https://shopify.dev/api/admin-rest/2023-10/resources/product#resource-object) for more information about what kinds of values to expect from these properties.
151157
152158
### Methods
153159

@@ -347,7 +353,7 @@ Filter by the vendor information from Shopify.
347353

348354
#### `images`
349355

350-
Images are stored as a blob of JSON, and only intended for use in a template in conjunction with a loaded product. Filtering directly by [image resource](https://shopify.dev/api/admin-rest/2022-10/resources/product-image#resource-object) values can be difficult and unpredictable—you may see better results using [the `.search()` param](https://craftcms.com/docs/4.x/searching.html#development).
356+
Images are stored as a blob of JSON, and only intended for use in a template in conjunction with a loaded product. Filtering directly by [image resource](https://shopify.dev/api/admin-rest/2023-10/resources/product-image#resource-object) values can be difficult and unpredictable—you may see better results using [the `.search()` param](https://craftcms.com/docs/4.x/searching.html#development).
351357

352358
```twig
353359
{# Find products that have an image resource mentioning "stripes": #}
@@ -414,13 +420,13 @@ Products behave just like any other element, in Twig. Once you’ve loaded a pro
414420
### Variants and Pricing
415421

416422
Products don’t have a price, despite what the Shopify UI might imply—instead, every product has at least one
417-
[Variant](https://shopify.dev/api/admin-rest/2022-10/resources/product-variant#resource-object).
423+
[Variant](https://shopify.dev/api/admin-rest/2023-10/resources/product-variant#resource-object).
418424

419425
You can get an array of variant objects for a product by calling [`product.getVariants()`](#productgetvariants). The product element also provides convenience methods for getting the [default](#productgetdefaultvariant) and [cheapest](#productgetcheapestvariant) variants, but you can filter them however you like with Craft’s [`collect()`](https://craftcms.com/docs/4.x/dev/functions.html#collect) Twig function.
420426

421427
Unlike products, variants in Craft…
422428

423-
- …are represented exactly as [the API](https://shopify.dev/api/admin-rest/2022-10/resources/product-variant#resource-object) returns them;
429+
- …are represented exactly as [the API](https://shopify.dev/api/admin-rest/2023-10/resources/product-variant#resource-object) returns them;
424430
- …use Shopify’s convention of underscores in property names instead of exposing [camel-cased equivalents](#native-attributes);
425431
- …are plain associative arrays;
426432
- …have no methods of their own;

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require": {
2323
"php": "^8.0.2",
2424
"craftcms/cms": "^4.3.0",
25-
"shopify/shopify-api": "^4.1"
25+
"shopify/shopify-api": "^5.2.0"
2626
},
2727
"require-dev": {
2828
"craftcms/ecs": "dev-main",

composer.lock

+39-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controllers/WebhooksController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use craft\shopify\Plugin;
1313
use craft\web\assets\admintable\AdminTableAsset;
1414
use craft\web\Controller;
15-
use Shopify\Rest\Admin2022_10\Webhook;
15+
use Shopify\Rest\Admin2023_10\Webhook;
1616
use Shopify\Webhooks\Registry;
1717
use Shopify\Webhooks\Topics;
1818
use yii\web\ConflictHttpException;

src/events/ShopifyProductSyncEvent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use craft\events\CancelableEvent;
1111
use craft\shopify\elements\Product as ProductElement;
12-
use Shopify\Rest\Admin2022_10\Product as ShopifyProduct;
12+
use Shopify\Rest\Admin2023_10\Product as ShopifyProduct;
1313

1414
/**
1515
* Event triggered just before a synchronized product element is going to be saved.

src/helpers/Metafields.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace craft\shopify\helpers;
99

1010
use craft\helpers\Json;
11-
use Shopify\Rest\Admin2022_10\Metafield as ShopifyMetafield;
11+
use Shopify\Rest\Admin2023_10\Metafield as ShopifyMetafield;
1212

1313
class Metafields
1414
{

src/services/Api.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Shopify\Auth\Session;
1717
use Shopify\Clients\Rest;
1818
use Shopify\Context;
19-
use Shopify\Rest\Admin2022_10\Metafield as ShopifyMetafield;
20-
use Shopify\Rest\Admin2022_10\Product as ShopifyProduct;
19+
use Shopify\Rest\Admin2023_10\Metafield as ShopifyMetafield;
20+
use Shopify\Rest\Admin2023_10\Product as ShopifyProduct;
2121
use Shopify\Rest\Base as ShopifyBaseResource;
2222

2323
/**
@@ -34,7 +34,7 @@ class Api extends Component
3434
/**
3535
* @var string
3636
*/
37-
public const SHOPIFY_API_VERSION = '2022-10';
37+
public const SHOPIFY_API_VERSION = '2023-10';
3838

3939
/**
4040
* @var Session|null

src/services/Products.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use craft\shopify\helpers\Metafields as MetafieldsHelper;
1515
use craft\shopify\Plugin;
1616
use craft\shopify\records\ProductData as ProductDataRecord;
17-
use Shopify\Rest\Admin2022_10\Metafield as ShopifyMetafield;
18-
use Shopify\Rest\Admin2022_10\Product as ShopifyProduct;
19-
use Shopify\Rest\Admin2022_10\Variant as ShopifyVariant;
17+
use Shopify\Rest\Admin2023_10\Metafield as ShopifyMetafield;
18+
use Shopify\Rest\Admin2023_10\Product as ShopifyProduct;
19+
use Shopify\Rest\Admin2023_10\Variant as ShopifyVariant;
2020

2121
/**
2222
* Shopify Products service.

0 commit comments

Comments
 (0)