Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add to Cart with Options: Redirects to the product page after clicking the button #8771

Closed
Tracked by #8054
thealexandrelara opened this issue Mar 16, 2023 · 0 comments · Fixed by #9691
Closed
Tracked by #8054
Assignees
Labels
block: add to cart form type: bug The issue/PR concerns a confirmed bug.

Comments

@thealexandrelara
Copy link
Contributor

thealexandrelara commented Mar 16, 2023

Describe the bug

While developing the Single Product block, we replaced the Product Add To Cart with the new Add to Cart with Options block. We noticed that when a user visits any page/post/template that is not the Single Product Template and clicks on the Add to Cart with Options block to add the product to the cart, the page is redirected to the product page, which I think it can be not very clear for the users.

To reproduce

Steps to reproduce the behavior:

  1. Log in to your WordPress dashboard;
  2. Go to Appearance > Themes, and select a block theme (for example: Twenty-twenty three);
  3. Go to Appearance > Site Editor;
  4. Click on Template Parts > Header;
  5. Click the Edit button;
  6. Click on the "+" icon to add a new block and search for "Single Product" block in the search bar;
  7. Click on the "Single Product" block to add it to your page or post;
  8. Select a product on the Product Selector and click on the Save button;
  9. Go to your website;
  10. Check that the page is redirected to the product page.

Screenshots

Screen.Recording.2023-03-16.at.17.34.10.mov

Expected behavior

I can see 2 scenarios that we could expect for when the user clicks on Add to Cart with Options button:

  1. Add the product to the cart, without redirecting the user, or;
  2. Add the product to the cart, and redirect the user to the Cart page

The only thing we should not

Environment

WordPress (please complete the following information):

  • WordPress version: 6.1.1
  • Gutenberg version (if installed): [e.g. 12.0.0]
  • WooCommerce version: [e.g. 6.1]
  • WooCommerce Blocks version: [e.g. 7.0.0]
  • Site language:
  • Any other plugins installed:

WordPress (please complete the following information):

  • WordPress version: 6.1.1
  • Gutenberg version (if installed): 15.0.1
  • WooCommerce version: 7.6.0-dev
  • WooCommerce Blocks version: 9.9.0-dev

Desktop (please complete the following information):

  • OS: MacOS Ventura
  • Browser Chrome
  • Version 111.0.5563.64

Additional context

Initially, the Add to Cart with Options was built to work inside the Single Product Template. However, now that we are developing the Single Product Block, we are reusing the same block as an inner block, and for this reason, we need to make the Add to Cart with Options block work properly on any page/post/template.

@thealexandrelara thealexandrelara added the type: bug The issue/PR concerns a confirmed bug. label Mar 16, 2023
@thealexandrelara thealexandrelara changed the title Add to Cart Form: Redirects to the product page after clicking the button Add to Cart Form: Redirects to the product page after clicking the button and styles is not being applied correctly Mar 21, 2023
@thealexandrelara thealexandrelara changed the title Add to Cart Form: Redirects to the product page after clicking the button and styles is not being applied correctly Add to Cart Form: Redirects to the product page after clicking the button May 15, 2023
@gigitux gigitux assigned gigitux and unassigned gigitux May 18, 2023
@thealexandrelara thealexandrelara self-assigned this May 25, 2023
@thealexandrelara thealexandrelara changed the title Add to Cart Form: Redirects to the product page after clicking the button Add to Cart with Options: Redirects to the product page after clicking the button Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.