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

Add DFC product groups with variants #13148

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

mkllnk
Copy link
Member

@mkllnk mkllnk commented Feb 13, 2025

What? Why?

Within OFN we have products and variants. Customers order variants. Several variants belong to a product so that they can be grouped in the shop front. Another name for a product stored as Spree::Product is a product group. And the variants stored as Spree::Variant correspond generally to a DFC product. So the naming gets really confusing.

The DFC now introduced a product-variant mapping as well and we use it to map our product-variant mapping.

  • Spree::Product is a DFC SuppliedProduct with the hasVariant attribute.
  • Spree::Variant is a DFC SuppliedProduct with the isVariantOf attribute.

With this new structure, we can get rid of our custom ofn:spree_product_id attribute.
Now we are also able to set a name and description for Spree::Product independent of the variant's name.

What should we test?

  • Test the DFC Product Import.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

A while ago I was told that an absent stock limitation means unlimited
stock. But that can't be distinguished from just not wanting to update
the stock level.

In the meantime, a new stock policy model was proposed. But for now we
have a workaround, setting `-1` as value for unlimited stock.

* datafoodconsortium/ontology#112
Our Spree::Product corresponds to a DFC SuppliedProduct with variants.
It just makes Rswag specs look more different to other request specs and
I found that discouraging. It's good to know that the parameter is just
specified with `let` and that it works exactly in the same way as `let`
in other specs.

The downside is maybe that it's not obvious that those `let` statements
have to correspond with the parameters for the request but error
messages will tell you if you got it wrong. And there's also the
`parameter` declaration to make that clear.
When importing another catalog, it's probably referring to external
product groups. Storing the external link allows us to group several
variants and replicate the same structure within OFN.
And when we import a catalog, we don't try to import those product
groups as Spree::Variant. We just see them as reference to
Spree::Product.
@mkllnk mkllnk added the api changes These pull requests change the API and can break integrations label Feb 13, 2025
@mkllnk mkllnk self-assigned this Feb 13, 2025
@mkllnk mkllnk marked this pull request as ready for review February 13, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api changes These pull requests change the API and can break integrations
Projects
Status: Code review 🔎
Development

Successfully merging this pull request may close these issues.

[DFC Products] Enable Variant Product mappings across DFC endpoints
1 participant