Skip to content

Commit

Permalink
Fixed date importing
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Apr 11, 2024
1 parent 4aac71b commit 72482b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Shopify

## Unreleased

- Fixed a PHP error that could occur when syncing products. ([#105](https://github.com/craftcms/shopify/issues/105))

## 4.1.1 - 2024-04-09

- Fixed a bug where syncing meta fields would cause Shopify API rate limiting.
Expand Down
7 changes: 4 additions & 3 deletions src/services/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use craft\base\Component;
use craft\events\ConfigEvent;
use craft\helpers\ArrayHelper;
use craft\helpers\Db;
use craft\helpers\ProjectConfig;
use craft\models\FieldLayout;
use craft\shopify\elements\Product;
Expand Down Expand Up @@ -145,17 +146,17 @@ public function createOrUpdateProduct(ShopifyProduct $product, array $metafields
'shopifyId' => $product->id,
'title' => $product->title,
'bodyHtml' => $product->body_html,
'createdAt' => $product->created_at,
'createdAt' => Db::prepareDateForDb($product->created_at),
'handle' => $product->handle,
'images' => $product->images,
'options' => $product->options,
'productType' => $product->product_type,
'publishedAt' => $product->published_at,
'publishedAt' => Db::prepareDateForDb($product->published_at),
'publishedScope' => $product->published_scope,
'shopifyStatus' => $product->status,
'tags' => $product->tags,
'templateSuffix' => $product->template_suffix,
'updatedAt' => $product->updated_at,
'updatedAt' => Db::prepareDateForDb($product->updated_at),
'variants' => $variants ?? $product->variants,
'vendor' => $product->vendor,
'metaFields' => $metaFields,
Expand Down

0 comments on commit 72482b3

Please sign in to comment.