WooCommerce tracking requirements

The table below shows the functions and hooks that are essential for WP Full Picture to track WooCommerce. Some plugins and themes may change or not include them.

  • Teasers must use an action hook: woocommerce_before_shop_loop_item
  • Every teaser must be wrapped in <li> element
  • Add to cart button must have a class .add_to_cart_button OR .ajax_add_to_cart
  • Teasers must use an action hook: woocommerce_widget_product_item_end
  • Every teaser must be wrapped in <li> element
  • Mini cart widget must use a hook woocommerce_after_mini_cart
  • Products in mini cart must use a filter woocommerce_cart_item_name
  • The “x” icon for removing items from cart must match selector a.remove.remove_from_cart_button
  • Cart must use a hook woocommerce_before_cart_contents
  • Items in cart must use a filter woocommerce_cart_item_name
  • Products must use a hook woocommerce_after_add_to_cart_button
  • Add to cart button must have a class .add_to_cart_button OR .ajax_add_to_cart
  • Single products must use a form element with class .cart
  • Variable products must use a form element with classes .cart and .variations_form
  • Grouped products must use a form element with class .grouped_form
  • Grouped products must use a filter woocommerce_grouped_product_list_column_label
  • Every grouped product should have a class .woocommerce-grouped-product-list-item

Checkout must use elements which match classes

  • .billing_email and .wp-block-woocommerce-checkout (for blocks)
  • .email and form.woocommerce-checkout (for classic checkout)
  • The link adding a product to a wishlist must be right after the “add to cart” button. Other placements may not work correctly.
  • The CSS selector of the link which adds products to a wishlist must be defined in the WooCommerce Tracking settings page

WP Full Picture can track “add to cart” events after visitors click links with “add-to-cart” parameter. For example:

example.com/cart/?add-to-cart=123&quantity=3

Events will be tracked if:

  1. The products are purchasable ($product->is_purchasable() results in a boolean value “true”)
  2. After the page redirects, the “add-to-cart” parameter is present in the target URL

If the “quantity” parameter is not present in the URL, the quantities is set to 1.

The event will be tracked on the target page. If, for any reason, you want to track add to cart on the page where the user clicked a link or a button, you need to add a class single_add_to_cart_button to the link and make sure that the product id can be found in the fpdata.woo.products array (check it in the browser console).

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments