Quick Reference
Overview
Logic Hop integrates with WooCommerce to provide personalization using WooCommerce data. You can easily create conditions and display WooCommerce data to create an engaging, personalized experience.
WooCommerce data such as products viewed, categories viewed, purchase history and shopping cart contents can be used in Logic Hop Conditions to determine what content to display and when to display it.
Note: WooCommerce functionality requires the Logic Hop WooCommerce Add-on.
WooCommerce Quick Start Guide
Here’s a simple example that checks if your visitor has products in their cart – If they do, the number of items is displayed. If they don’t, they’ll see a “your cart is empty” message.
Step 1
Create a new page titled WooCommerce Test
Step 2
Add the following Logic Tags:
{% if condition: woocommerce_cart_empty %} <h2>Your cart is empty.</h2> {% else %} <h2>Your cart has {{ var: WooCommerce.Cart }} items.</h2> {% endif %}
Step 3
That’s all there is to it! Now view the page with and without products in your cart to see the messaging in action.
Configuring WooCommerce
- Install and activate the WooCommerce Add-on plugin
Displaying WooCommerce Data
Logic Hop provides a variety of integration points for WooCommerce including WooCommerce user data display within WordPress content using Logic Tags, Javascript or PHP.
Display WooCommerce Data with Logic Tags
Logic Tags can be added from the Logic Hop tool in the WordPress Page/Post editor. Click the Data tab, select a value and click Insert Variable.
Like all Logic Tags for data, the WooCommerce Logic Tag is a single block of code which appears as:
{{ var: WooCommerce.Customer.FirstName }}
If the data is available for the user, it will be displayed on the page. Logic Tags can be nested within HTML tags and also within Logic Tag conditions.
To check if data is available before display, use the default condition WooCommerce Customer Data Available:
{% if condition: woocommerce_customer %} <h2>Welcome back {{ var: WooCommerce.Customer.FirstName }}!</h2> {% endif %}
View the full list of WooCommerce variables.
Using WooCommerce Data with Conditions
WooCommerce activity and data can be used as parameters in Logic Hop Conditions. Default conditions are provided for common scenarios and are accessible from the Logic Hop tool palette in the Page/Post editor.
WooCommerce Default Conditions
- WooCommerce Shopping Cart is Empty
- If the cart is empty
- WooCommerce Shopping Cart has Products
- If the cart is not empty
- WooCommerce Customer Data Available
- If customer data is available
- WooCommerce Paying Customer
- If the user is a paying customer
WooCommerce Condition Types
The Logic Hop Condition Builder will display all WooCommerce condition types available for use. Each can be used alone or combined with other condition types to create complex logic.
- WooCommerce Shopping Cart
- Is the cart empty or does it have products
- WooCommerce Customer Data Available
- Is customer data available
- WooCommerce Paying Customer
- Is this a paying customer
- WooCommerce Orders
- The number of orders the visitor has made
- WooCommerce Total Spend
- The total amount of money the visitor has spent
- WooCommerce Product in Cart
- Is a specific product in the cart
- WooCommerce Product Views – All Visits
- Has a specific product been viewed during any visit
- WooCommerce Product Views – Current Session
- Has a specific product been viewed during the current session
- WooCommerce Product Purchased
- Has a specific product been purchased
- WooCommerce Product in Category
- Is a product in a specific category
- WooCommerce Category Views – All Visits
- Has a category been viewed during any visit
- WooCommerce Category Views – Current Session
- Has a category been viewed during the current session
- WooCommerce Purchase from Category
- Has a purchase been made from a specific category
- WooCommerce Product has Tag
- Does the product have a specific tag
- WooCommerce Tag Views – All Visits
- Has a tag been viewed during any visit
- WooCommerce Tag Views – Current Session
- Has a tag been viewed during the current session
WooCommerce Variables
- WooCommerce
- Customer
- Active
- boolean
- ID
- integer
- Username
- string
- Email
- string
- FirstName
- string
- LastName
- string
- AvatarURL
- string
- OrderCount
- integer
- TotalSpend
- string
- PayingCustomer
- boolean
- Active
- OrderLookup
- boolean
- Cart
- integer
- Number of items in cart
- InCart
- array
- IDs of products in cart
- Products
- array
- IDs of products viewed
- ProductsSession
- array
- IDs of products viewed this session
- ProductsPurchased
- array
- IDs of products purchased
- Category
- array
- IDs of categories on the current product page
- Categories
- array
- IDs of categories viewed
- CategoriesPurchased
- array
- IDs of categories purchased from
- CategoriesSession
- array
- IDs of categories viewed this session
- Tag
- array
- IDs of tags on the current product page
- Tags
- array
- IDs of tags viewed
- TagsSession
- array
- IDs of tags viewed this session
- Customer