Show Popup on Custom Pages
-
If you don’t have the PRO version, this is how to get the popup to work on custom pages (non-Woocommerce pages).
Copy and paste the following code to your child theme’s functions.php file:
function wup_upsell_popup_scripts_enqueue () { if (( is_page( 13 ) ) && (! thp_wuppro_active() )) { //CHANGE 13 TO THE ID OF YOUR PAGE! $ajax_enabled = get_option( 'woocommerce_enable_ajax_add_to_cart' ); if ( 'yes' === $ajax_enabled ) { wp_enqueue_script( 'thp-popup-js', get_site_url().'/wp-content/plugins/very-simple-woocommerce-upsell-popup/js/wup-ajax.min.js', array('jquery'), '', false ); wp_localize_script( 'thp-popup-js', 'thp_popup_vars', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'added_to_cart' => __( 'Added to Cart!', 'very-simple-woocommerce-upsell-popup' ) ) ); wp_enqueue_script( 'wup-noajax-js', get_site_url().'/wp-content/plugins/very-simple-woocommerce-upsell-popup/js/wup-noajax.min.js', array('jquery'), '', false ); } elseif ( 'yes' != $ajax_enabled ) { wp_enqueue_script( 'wup-noajax-js', get_site_url().'/wp-content/plugins/very-simple-woocommerce-upsell-popup/js/wup-noajax.min.js', array('jquery'), '', false ); } } } add_action( 'wp_enqueue_scripts', 'wup_upsell_popup_scripts_enqueue' );
Don’t forget to change the ID in the code above (line 3) to the actual ID of your page!
If you have the PRO version, refer to this documentation instead: https://woocommerce.upsellpopup.com/docs/woocommerce-upsell-popup-pro-docs/troubleshooting/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show Popup on Custom Pages’ is closed to new replies.