Closed dazlious closed 2 years ago
Hello @dazlious,
Thanks for writing us. Yes, This project doesn't support syncing Product-discounts yet. Can you try copying Product-discounts manually and then perform sync using this project?
Thanks.
@praveenkumarct: I can sync the product-discounts manually. I can also create them manually. The issue here is that the uuid of the source project product discount needs to be found in the source project.
AFAIK I cannot create a product discount with a specific id, or can I?
Additionally, as the tool is not able to sync product-discounts, why doesn't it skip this field for now and syncs without the discount?
One possibility would be to fork the repo and either modify the way we build the drafts from fetched data of the source project (be ignoring of the price discounts) or by the usage of the beforeCreate and beforeUpdate callbacks which can be defined here. Example of the callbacks can be found here. In the beforeCreate callback you can then return a new draft without the discount and in the beforeUpdate callback you can filter for price change update actions and remove from those the discounts too.
Additionally, as the tool is not able to sync product-discounts, why doesn't it skip this field for now and syncs without the discount?
We will check if we can support that case.
Additionally, as the tool is not able to sync product-discounts, why doesn't it skip this field for now and syncs without the discount?
Upvote for a fix on that. It is very tedious for product syncs to fail on the Product Discounts. Its not needed to to have the Product Discount Reference on the target project as the products would evaluate against the active product discounts nevertheless after product creation/update
We will be looking into this issue in the upcoming 3-4 weeks. If you mind this fix earlier you can create a PR.
The issue might be fixed in project-sync if we iterate over the returned drafts here: https://github.com/commercetools/commercetools-project-sync/blob/883f28dc55a00e66cabcf0d84a9e20f725819e43/src/main/java/com/commercetools/project/sync/product/ProductSyncer.java#L111
and set the discount for each of the prices to null with that: https://github.com/commercetools/commercetools-jvm-sdk/blob/3ddea540456425553739869d7ac0c3c53bf16d51/commercetools-models/src/main/java/io/sphere/sdk/products/PriceDraftBuilder.java#L119
In our project, we are experiencing issues when syncing our products.
The main reason for that is that the prices include the discount which is not synced by this tool.
This command is being used:
This is the error we are running into.