Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product custom fields not syncing #52

Closed
mattias78 opened this issue Dec 31, 2022 · 6 comments
Closed

Product custom fields not syncing #52

mattias78 opened this issue Dec 31, 2022 · 6 comments
Assignees
Labels
bug Something isn't working evaluating Issue needs further investigation

Comments

@mattias78
Copy link

Description

When deploying from local to other environments (production etc) custom fields applied to products are not syncing.

Steps to reproduce

  1. Add custom fields to products via Shopify plugin (in my case a Matrix field) /admin/shopify/settings#products. All working fine.
  2. Deploy then run 'craft up' on the other environment (fields appear to have been applied according to terminal).
  3. 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 mattias78 added the bug Something isn't working label Dec 31, 2022
@lukeholder lukeholder self-assigned this Jan 18, 2023
@lukeholder
Copy link
Member

@mattias78 I am unable to reproduce this.

Were you able to figure out what was going wrong when deploying?

@lukeholder lukeholder added the evaluating Issue needs further investigation label Jan 18, 2023
@Mosnar
Copy link

Mosnar commented Feb 8, 2023

@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.

$metaFields = $api->getMetafieldsByProductId($this->shopifyProductId);
$product->setMetafields($metaFields);
Craft::$app->elements->saveElement($product);

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.

@astuteo
Copy link

astuteo commented Apr 28, 2023

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.

@astuteo
Copy link

astuteo commented Apr 29, 2023

@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).

@lukeholder
Copy link
Member

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.

@lukeholder
Copy link
Member

This is now out in 3.2.0!

See the notes in the upgrading section of the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working evaluating Issue needs further investigation
Projects
None yet
Development

No branches or pull requests

4 participants