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

Discount not applied to items in subcategory #15327

Open
phwoelfel opened this issue Jan 26, 2024 · 1 comment
Open

Discount not applied to items in subcategory #15327

phwoelfel opened this issue Jan 26, 2024 · 1 comment
Labels
bug merchant Merchant Experience team topics triage

Comments

@phwoelfel
Copy link

What are you trying to achieve?

I have created a discount through the saleor dashboard, set it to 10%, start date now and added my main category under which all other categories are. The product counter next to the category shows the correct amount of products in this category and all its subcategories.
When I now query the products in one of the subcategories I don't get the discount returned.
When I add the subcategory to the assigned categories in the discount, the discount is applied correctly through the graphql API.

Steps to reproduce the problem

  1. Create a category "Category 1"
  2. Create a subcategory "Category 1.1"
  3. Create a product "Product 1" in category "Category 1"
  4. Create a product "Product 1.1" in category "Category 1.1"
  5. Create a discount and add "Category 1"
  6. Query products through grapqhql including discount prices. "Product 1" will have a discount, "Product 1.1" not. When "Category 1.1" is added to the discount, the products in "Category 1.1" also get the discount applied.

What did you expect to happen?

The discount is applied to the category and all its subcategories. This is indicated by the "Products" count in the dashboard when adding categories to the discount.

Logs

Partial graphql response when only "Category 1" is added to the discount:

{
  "data": {
    "products": {
      "totalCount": 9,
      "edges": [
        {
          "node": {
            "id": "UHJvZHVjdDo4",
            "name": "Product 1",
            "pricing": {
              "priceRange": {
                "start": {
                  "gross": {
                    "amount": 13.5
                  }
                }
              },
              "discount": {
                "gross": {
                  "amount": 1.5,
                  "currency": "EUR"
                }
              }
            }
          }
        },
        {
          "node": {
            "id": "UHJvZHVjdDo5",
            "name": "Product 1.1",
            "pricing": {
              "priceRange": {
                "start": {
                  "gross": {
                    "amount": 15
                  }
                }
              },
              "discount": null
            }
          }
        },
        ...

response when both categories added to the discount:

{
  "data": {
    "products": {
      "totalCount": 9,
      "edges": [
        {
          "node": {
            "id": "UHJvZHVjdDo4",
            "name": "Product 1",
            "pricing": {
              "priceRange": {
                "start": {
                  "gross": {
                    "amount": 13.5
                  }
                }
              },
              "discount": {
                "gross": {
                  "amount": 1.5,
                  "currency": "EUR"
                }
              }
            }
          }
        },
        {
          "node": {
            "id": "UHJvZHVjdDo5",
            "name": "Product 1.1",
            "pricing": {
              "priceRange": {
                "start": {
                  "gross": {
                    "amount": 13.5
                  }
                }
              },
              "discount": {
                "gross": {
                  "amount": 1.5,
                  "currency": "EUR"
                }
              }
            }
          }
        },
        ...

Eligible categories shows 2 products for "Category 1" (one is directly in the category, one in the subcategory):
image

Environment

Saleor version: dashboard v3.18.0 core v3.18.9
OS and version: saleor platform, docker through colima on mac OS

@phwoelfel
Copy link
Author

Any response if this is intentional or not?

@maarcingebala maarcingebala added the merchant Merchant Experience team topics label Feb 12, 2024
@slawekmarszalek slawekmarszalek changed the title Bug: Discount not applied to items in subcategory Discount not applied to items in subcategory Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug merchant Merchant Experience team topics triage
Projects
None yet
Development

No branches or pull requests

2 participants