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

Cross-Sells Products block: Replace Add to Cart block with Product Button block #8858

Closed
Tracked by #8710
nielslange opened this issue Mar 27, 2023 · 3 comments · Fixed by #8914
Closed
Tracked by #8710

Cross-Sells Products block: Replace Add to Cart block with Product Button block #8858

nielslange opened this issue Mar 27, 2023 · 3 comments · Fixed by #8914
Assignees
Labels
block: cross-sells Issues related to the cross-sells block. type: refactor The issue/PR is related to refactoring.

Comments

@nielslange
Copy link
Member

nielslange commented Mar 27, 2023

In woocommerce/woocommerce#44503, @kmanijak suggested removing the Add to Cart block as that block is experimental, hasn't been touched for 3 years and as there's a newer block. Currently, the Cross-Sells Block is still using the Add to Cart block. This issue aims to replace the Add to Cart block with the Product Button block within the Cross-Sells Products block.

@nielslange nielslange added type: refactor The issue/PR is related to refactoring. block: cross-sells Issues related to the cross-sells block. labels Mar 27, 2023
@ralucaStan
Copy link
Contributor

  • Is the Add to Cart used in other places?
  • What are the immediate advantages of using the Add to Cart Form block?

@nielslange
Copy link
Member Author

  • Is the Add to Cart used in other places?

The <AddToCartButton/> component is used in the following files:

  1. assets/js/blocks/cart/cart-cross-sells-product-list/cart-cross-sells-product.tsx
  2. assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/index.tsx
  3. assets/js/atomic/blocks/product-elements/add-to-cart/product-types/simple.tsx

The first file loads the component from assets/js/atomic/blocks/product-elements/add-to-cart/block.tsx, the second and third file load the component from assets/js/atomic/blocks/product-elements/add-to-cart/shared/add-to-cart-button.tsx.

  • What are the immediate advantages of using the Add to Cart Form block?

Switching <AddToCartButton /> to <ProductButton /> allows us to remove the Add To Cart Button block as well as it ensures that the buttons of Cross-Sells products support Global Styles. Below you can find a screenshot that shows how the Cross-Sells block would be impacted by a switch from <AddToCartButton /> to <ProductButton />.

<AddToCartButton />



Screenshot 2023-03-30 at 14 33 17

<ProductButton />



Screenshot 2023-03-30 at 14 32 46

@nielslange nielslange self-assigned this Mar 31, 2023
@nielslange nielslange changed the title Cross-Sells Products block: Replace Add to Cart block with Add to Cart Form block Cross-Sells Products block: Replace Add to Cart block with Product Button block Mar 31, 2023
@tarunvijwani
Copy link

Closed by #8914 PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cross-sells Issues related to the cross-sells block. type: refactor The issue/PR is related to refactoring.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants