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

As a Shop API consumer, I want to see the current applied catalog promotions of a Product Taxon #16236

Open
ebarbeito opened this issue May 8, 2024 · 1 comment
Labels
API APIs related issues and PRs. Feature New feature proposals. RFC Discussions about potential changes or new features.

Comments

@ebarbeito
Copy link

Describe the proposed need and solution

After configuring several active catalog promotions with taxon scopes, I aim to display the list of applied promotions for a specific product taxon.

In the latest release (v1.13.0), the Shop API (/api/v2/shop) offers an endpoint to retrieve a ProductTaxon resource. Here's an example usage along with a sample response:

$ curl -X 'GET' \
  'https://localhost:8000/api/v2/admin/product-taxons/40' \
  -H 'accept: application/ld+json' -s | jq
{
  "@context": "/api/v2/contexts/ProductTaxon",
  "@id": "/api/v2/shop/product-taxons/40",
  "@type": "ProductTaxon",
  "id": 40,
  "product": "/api/v2/shop/products/opowatch",
  "taxon": "/api/v2/shop/taxons/opowear",
  "position": 0
}

I am wondering if it would be possible to include an array of channels and their respective applied promotions for a specific taxon. So we retrieve the catalog promotion jsonlds

...
"appliedPromotions": [
  {
    "@id": "/api/v2/shop/catalog-promotions/somepromo",
    "@type": "CatalogPromotion",
    "id": 6,
    "code": "somepromo"
  }
],
...

Describe alternatives you've considered

The current alternative is to retrieve all the catalog promotions to iterate over them, checking their configuration scopes and filtering those ones which apply for the targeted product taxon.

Additional context

Could the inclusion of "appliedPromotions" in the ProductTaxon resource be considered?

I understand that this feature request may not currently be of high priority. Would you be open to accepting a pull request from me to implement this feature?

Thank you in advance.

@GSadee GSadee added Feature New feature proposals. API APIs related issues and PRs. RFC Discussions about potential changes or new features. labels May 17, 2024
@GSadee
Copy link
Member

GSadee commented May 17, 2024

Hi @ebarbeito!

Could you describe your use case?
From my perspective, I am mainly wondering why on a taxon product and not simply on taxon, where it would probably make more sense. 🤔 Nevertheless, I have doubts as to whether such functionality is needed by default in Sylius, or whether it is something you can add in your end application. Especially, as catalog promotions are applied directly to variants and not to products or taxons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Feature New feature proposals. RFC Discussions about potential changes or new features.
Projects
None yet
Development

No branches or pull requests

2 participants