Get a fast, conversion-focused WooCommerce theme in 2024. Switch to Shoptimizer.

Home Documentation CommerceGurus Popups Include a Separate Close Button

Include a Separate Close Button

Within your popup content you may wish to include a separate button which closes the popup. An example of this can be seen in the screenshot below.

Close Button

A visitor can already dismiss the popup via the ‘x’ on the top right corner, but we’d also like it to close when the No thanks button is clicked.

To do this we can add a shortcode to the popup content area.

[cgpopups_btn_close label="No thanks" width="fullwidth"]

This is what it looks like within the WordPress editor.

Close button within the WordPress editor

You can add a shortcode by clicking on the plus icon and looking for the shortcode block.

The following attributes are available to use within the [cgpopups_btn_close] shortcode.

  • label — The button label text.
  • width — inline or fullwidth.
  • class — Adds a custom CSS class so you can further customize the style of the close button.