woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.42k stars 10.77k forks source link

[Single Product] Having a Post/ProductTemplate block within the Single Product breaks the expected execution for passing the context #45374

Open xristos3490 opened 8 months ago

xristos3490 commented 8 months ago

Prerequisites

Describe the bug

Adding a Query Loop or a Product Collection block within the Single Product container breaks the execution sequence, as expected by the Single Product's block context handler. That's because the woocommerce/product-template block's inner blocks are repeated for each query result, and these additional renders do not exist within the $this->single_product_inner_blocks_names array.

Expected behavior

The special needs of a Post/Product Template block should be utilized in the recurring process of passing the context.

Actual behavior

Currently, the Post/ProductTemplate blocks are rendering more inner blocks than whats expected when fetching the blocks inner blocks.

See

310572697-4c61194f-a7e9-4354-8009-f4f924e1680c (1)

Steps to reproduce

  1. Create a new page/post.
  2. Add a Single Product block and select a product.
  3. Add a QueryLoop block or a Product Collection block on top of the product title.
  4. Save and navigate to storefront.
  5. Notice the blocks being broken.

WordPress Environment

-

Isolating the problem

jconroy commented 8 months ago

See sad

Just an FYI, that image seems to be private

xristos3490 commented 8 months ago

Thanks for catching this, @jconroy! Updated! 🙌