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

Cart adapter for customer data storage cache is missing on the server side, causing issues when using a combination of headful and headless approaches #39374

Open
1 of 5 tasks
tuyennn opened this issue Nov 16, 2024 · 8 comments
Labels
Area: Cart & Checkout Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@tuyennn
Copy link
Member

tuyennn commented Nov 16, 2024

Preconditions and environment

  • Magento version: 2.4.x

Steps to reproduce

  1. Add some products to cart.
  2. Perform checkout steps with address, shipment, payment
  3. Make sure a shipping address was set.
  4. Select Flat Rate - Fixed as shipping method.
  5. Observe the selected_shipping_method expected Flat Rate - Fixed
  6. Perform getcart graphql query {cart(cart_id: String!) {Cart}} to get current cart information
{
  cart(cart_id: "KWN2HqDtvs7M7acbUilpa39jw5Ktd7Sx") {
    email
    billing_address {
      city
      country {
        code
        label
      }
      firstname
      lastname
      postcode
      region {
        code
        label
      }
      street
      telephone
    }

    shipping_addresses {
      firstname
      lastname
      street
      city
      region {
        code
        label
      }
      country {
        code
        label
      }
      telephone

      available_shipping_methods {

        amount {
          currency
          value
        }

        available
        carrier_code
        carrier_title
        error_message
        method_code
        method_title
        price_excl_tax {
          value
          currency
        }

        price_incl_tax {
          value
          currency
        }

      }

      selected_shipping_method {
        amount {
          value
          currency
        }
        carrier_title
        method_title
      }
    }

    available_payment_methods {
      code
      title
    }

    selected_payment_method {
      code
      title
    }

    applied_coupons {
      code
    }

    prices {
      grand_total {
        value
        currency
      }
    }
  }
}
  1. Select Free - Free Shipping as shipping method.
  2. Observe the selected_shipping_method , still Flat Rate - Fixed

Expected result

  • selected_shipping_method consistent while performing get cart graphql and last selected state

Actual result

  • selected_shipping_method inconsistent while performing get cart graphql and last selected state
  • cart-data information could not be accessed from GraphQl, restAPI for current quote
CartAdapter-2024-11-20_14.54.53.mp4

Additional information

  • Observe the mage-cache-storage.
  • The cart-data stores cart information in the customer's local storage (localStorage) without saving it on the server.
    image
  • The cart-data can be accessed by other services, such as GraphQL and REST API, to retrieve the current quote. This is important because multiple services can use the same resource and transfer customer data between headful and headless systems, such as AEM pages and Luma-based stores.
  • For reference, this cache is implemented in the following file: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Checkout/view/frontend/web/js/model/cart/cache.js, which stores cart data in the customer's local storage without saving it on the server.
  • When a customer selects a shipping method during checkout, Magento calls the REST API endpoint rest/V1/guest-carts/{cartId}/totals-information or /rest/default/V1/carts/mine/totals-information. However, this does not save the selected shipping method or totals at the server level. Instead, only the cart data (cart-data) is cached in the customer's local storage.
  • Suggestion: Implement server-side caching for the selected totals and shipping methods. This would allow other services to access the cached totals, ensuring consistency across different systems.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Nov 16, 2024

Hi @tuyennn. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Nov 16, 2024
@tuyennn tuyennn changed the title Cart adapter for customer data storage cache missing from server side, problem while using headless such as PWA, AEM Cart adapter for customer data storage cache missing from server side, problem while using combine headfull & headless such as PWA, AEM Nov 18, 2024
@tuyennn tuyennn changed the title Cart adapter for customer data storage cache missing from server side, problem while using combine headfull & headless such as PWA, AEM Cart adapter for customer data storage cache is missing on the server side, causing issues when using a combination of headful and headless approaches, such as PWA and AEM. Nov 18, 2024
@tuyennn tuyennn changed the title Cart adapter for customer data storage cache is missing on the server side, causing issues when using a combination of headful and headless approaches, such as PWA and AEM. Cart adapter for customer data storage cache is missing on the server side, causing issues when using a combination of headful and headless approaches, such as Luma and AEM. Nov 18, 2024
@tuyennn tuyennn changed the title Cart adapter for customer data storage cache is missing on the server side, causing issues when using a combination of headful and headless approaches, such as Luma and AEM. Cart adapter for customer data storage cache is missing on the server side, causing issues when using a combination of headful and headless approaches Nov 18, 2024
@engcom-Bravo engcom-Bravo added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Nov 18, 2024
@engcom-Delta engcom-Delta self-assigned this Nov 18, 2024
Copy link

m2-assistant bot commented Nov 18, 2024

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta
Copy link
Contributor

Hi @tuyennn ,

Thanks for your reporting and collaboration.
We have re-verified the issue in Latest 2.4-develop instance , but we are unable to reproduce the issue. Kindly refer the screenshots.

Steps to reproduce

  1. Add some products to cart.
  2. Perform checkout steps with address, shipment, payment
  3. Switch between some available shipping methods
  4. Perform getcart graphql query {cart(cart_id: String!) {Cart}} to get current cart information
  5. Observe the selected_shipping_method with last state on step 3
    image

Observe, selected_shipping_method consistent while performing get cart graphql and last selected state

Can you please re-verify and confirm if you are still facing the issue.
Thanks.

@engcom-Delta engcom-Delta added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels Nov 19, 2024
@tuyennn
Copy link
Member Author

tuyennn commented Nov 19, 2024

@engcom-Delta on headfull luma checkout, can you select a different shipping method than ups, stop right there and perform graphql query for this cart also, if so you still got ups as selected shipping method from query result. You found the problem.

Edit: Add screenshot
image

@engcom-Bravo engcom-Bravo moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Nov 20, 2024
@engcom-Delta
Copy link
Contributor

Hi @tuyennn ,

Thanks for providing additional testing steps.
We have re-verified the issue in latest 2.4-develop instance and the issue is reproducible.
Kindly refer the screenshots.

Steps to reproduce

  1. Add some products to cart.
  2. Perform checkout steps with address, shipment, payment
  3. Switch between some available shipping methods
  4. Perform getcart graphql query {cart(cart_id: String!) {Cart}} to get current cart information
  5. Observe the selected_shipping_method with last state on step 3
    image
    image

Thanks.

@engcom-Delta engcom-Delta added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: GraphQL GraphQL Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Cart & Checkout and removed Issue: needs update Additional information is require, waiting for response labels Nov 20, 2024
@m2-community-project m2-community-project bot removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Nov 20, 2024
@m2-community-project m2-community-project bot added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Nov 20, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13381 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented Nov 20, 2024

✅ Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@github-jira-sync-bot
Copy link

❌ You don't have permission to export this issue.

@engcom-Bravo engcom-Bravo moved this from Needs Update to Confirmed in Issue Confirmation and Triage Board Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Cart & Checkout Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

No branches or pull requests

4 participants