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

The select_content event is not triggered correctly on the product list page #352

Closed
eason9487 opened this issue Jan 25, 2024 · 1 comment
Labels
type: bug The issue/PR is a confirmed bug.

Comments

@eason9487
Copy link
Member

eason9487 commented Jan 25, 2024

Describe the bug:

If I understood it right, the select_content event on the product list page is supposed to be triggered from navigating to any product page when clicking on the product that doesn't have a direct add-to-cart button.

Actions to trigger:

  • Clicking on the product image
  • Clicking on the product name under the product image
  • Clicking on the button under the product image that doesn't directly add to cart
    • External product
    • Product bundle
    • Any out-of-stock simple or grouped products

And, its triggering behavior should be consistent and without duplication in these themes or a custom page:

  • Themes not using blocks, e.g. Storefront.
  • Themes using blocks, e.g. Twenty Twenty-Three.
  • A custom page using the All products block.
  • A custom page using the Products (Beta) block.

Steps to reproduce:

Since there are so many permutations, only a few of failure cases are presented here.

  1. Install and activate Woo Product Bundles.
  2. Set up a non-block theme, e.g. Storefront.
  3. Set up this extension:
    • Select "Use Global Site Tag" and all Tracking Options.
    • Enable "Enable Enhanced eCommerce" and all sub-options.
  4. Set up DevTool:
    • Open browser's DevTool and switch to the Network tab.
    • Tick "Preserve log".
    • Select "All" and filter the keyword by "select_content"
    • image
  5. Set up products:
    • Set up a simple product and set it as out of stock.
    • Set up a product with the "Product bundle" type.
    • Set up a product with the "External/Affiliate product" type.
  6. Go to the shop list page.
  7. Click the button of each product set in step 5.
  8. Click on any product image.
  9. Switch to the Network tab of DevTool to inspect requests.
  10. None of the above actions have triggered a select_content event.
  11. Set up a block theme, e.g. Twenty Twenty-Three.
  12. Go back to the shop list page.
  13. Click on any product image.
  14. Click on any product name under the product image.
  15. Switch to the Network tab of DevTool to inspect requests.
  16. None of the above actions have triggered a select_content event.

Additional details:

Related issues

This issue is highly related to #351 because the code is constructed with if...else together:

if ( false === $(this).hasClass( 'product_type_variable' ) && false === $(this).hasClass( 'product_type_grouped' ) ) {
$add_to_cart_event_code
} else {
$select_content_event_code
}

Furthermore, this issue may seem to be relevant to #208, but the root cause here is that HTTP requests for recording events are not sent at all.

Related code changes that may introduce this issue

@eason9487 eason9487 added the type: bug The issue/PR is a confirmed bug. label Jan 25, 2024
@eason9487 eason9487 mentioned this issue Feb 5, 2024
66 tasks
@martynmjones
Copy link
Contributor

Closing issue after re-testing with the changes made in #322 were merged and select_content events are triggered for everything highlighted except when using the shop archive on a block powered theme. That's because of an issue in WooCommerce Blocks so a follow up issue will be opened in that repo to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug The issue/PR is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

2 participants