1. Home
  2. Docs
  3. Popup Notices: Added to C...
  4. How To
  5. Unlocking Dynamic Content: Template Variables in Pop Up Notices for WooCommerce

Unlocking Dynamic Content: Template Variables in Pop Up Notices for WooCommerce

pasted image 0 3 9

Pop Up Notices by WP Factory empowers you to create impactful pop-up notifications for your WooCommerce store. But what if you want to personalize your message content with dynamic details? This article explores the plugin’s Template Variables feature, equipping you to craft dynamic pop-up messages that enhance customer engagement.

Admin Access and Navigation

For admins to access these settings

  • Navigate to your WordPress dashboard.
  • Click on WooCommerce in the sidebar menu.
  • Click on Pop Up Notices.
  • Click on the Messages sub-tab.

Power of Template Variables

The Modified HTML Content field within the Messages Customization settings allows you to leverage Template Variables. These variables dynamically insert specific details into your pop-up messages, making them more relevant and impactful.

Available Template Variables

Here are some of the commonly used template variables for your reference.

  • {{product_id}}: Inserts the ID of the product associated with the message.
  • {{post_title}}: Inserts the title of the post or product associated with the message.
  • {{cart_permalink}}: Inserts the permalink (URL) leading directly to the customer’s cart.
  • {{myaccount_permalink}}: Inserts the permalink leading to the customer’s account page.
  • {{shop_permalink}}: Inserts the permalink leading to your store’s main shop page.
  • {{checkout_permalink}}: Inserts the permalink leading to the checkout page.
  • {{terms_permalink}}: Inserts the permalink leading to your store’s terms and conditions page.

Examples in Action

Let’s explore some real-world examples of using template variables

Modifying the “Add to Cart” Message

  • Original Message: “%s has been added to your cart.”
  • Modified Message (using template variable): “{{post_title}} has been added to your cart. View your cart here: {{cart_permalink}}”

Modifying the “Cannot Add Another” Message

  • Original Message: “You cannot add another “%s” to your cart.”
  • Modified Message (using template variable): “You cannot add another {{post_title}} to your cart. Check out similar products here: {{shop_permalink}}”

Important Considerations

  • While the above template variables are commonly used, some might not work in all contexts. Experiment and test your pop-up messages to ensure the variables function as intended.
  • Examples for Original HTML Content: While the article focuses on Modified HTML Content, the provided examples using the [ttt_pnwc_get_message] shortcode demonstrate how to modify existing WooCommerce messages within the Original HTML Content field.

Crafting Dynamic Pop-Up Experiences

By incorporating template variables into your pop-up messages, you can create a more personalized and engaging experience for your customers. Remember to use these variables strategically to provide valuable information and ultimately drive desired actions within your WooCommerce store.