Product custom fields not syncing
mattias78 opened this issue · 6 comments
Description
When deploying from local to other environments (production etc) custom fields applied to products are not syncing.
Steps to reproduce
- Add custom fields to products via Shopify plugin (in my case a Matrix field) /admin/shopify/settings#products. All working fine.
- Deploy then run 'craft up' on the other environment (fields appear to have been applied according to terminal).
- Navigate to a product in the admin panel and fields don't appear in admin.
- adding shopify.productFieldLayout.348b5ee9-6c62-405f-867c-ff9aeb292e8d.tabs.0.elements.0 ... done
- updating shopify.productFieldLayout.348b5ee9-6c62-405f-867c-ff9aeb292e8d.tabs.0 ... done
Finished applying changes
Additional info
- Craft version: 4.3.5
- PHP version: 8.1
- Database driver & version: MySQL 10.3.25
- Plugins & versions: Shopify 3.1.0
@mattias78 I am unable to reproduce this.
Were you able to figure out what was going wrong when deploying?
@mattias78 I am unable to reproduce this.
Were you able to figure out what was going wrong when deploying?
I believe this is only an issue for metadata sync occurring in the queue job, not through a manual sync.
shopify/src/jobs/UpdateProductMetadata.php
Lines 25 to 27 in 1ab7279
The job is setting the metadata on the product; however, there's no mechanism in the product element to actually save the metadata to the custom table.
Notice the createOrUpdateProduct
method expects the metadata to be passed in and the records are updated within the service rather than the element.
Same issue for me.
Craft CMS 4.4.8
Craft/Shopify 3.1.0
PHP 8.0.2
Setup Craft Shopify integration locally and added custom fields to Shopify>Products. Just basic product description text fields, etc.
When deploying to production the project-config applies successfully, but no fields appear in Shopify>Products.
@mattias78 Were you ever able to resolve this issue?
I'm not sure why this can't issue can't be replicated on the part of @lukeholder. I have a Shopify config file with the fields saved correctly. If I pulldown a DB that doesn't have them added yet, and run project-config/apply
, it does nothing. I can't figure out the why, but it makes the Craft Shopify plugin borderline unusable. Only way I've found to resolve is to literally copy the local DB manually up to production (which is obviously a big problem).
Thanks for reporting.
This has been fixed for the next release.
To get the fix early, change your craftcms/shopify
requirement in composer.json to:
"require": {
"craftcms/shopify": "dev-develop#9eaa4b57e65a4da5ded7b2a626fcd4d2014f2f78 as 3.1.1",
"...": "..."
}
Then run composer update
.
This is now out in 3.2.0!
See the notes in the upgrading section of the README