• Is it possible to add this to an Elementor single product template using a shortcode? It’s not showing up when enabled for a single product page.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I had the same issue and ended up having to create a shortcode to then place the widget in the Elementor template. The Zip widget hooks in to the normal WooCommerce woocommerce_single_product_summary which of course doesn’t get triggered when creating your own product template in Elementor.

    My shortcode contains this if it is of any use to anyone:

    if ( ! class_exists( 'WC_Zipmoney_Payment_Gateway' ) ) {
                return;
            }
            $zip                                     = new WC_Zipmoney_Payment_Gateway();
            $zip->WC_Zipmoney_Payment_Gateway_Config = new WC_Zipmoney_Payment_Gateway_Config( $zip );
            $zipWidget                               = new WC_Zipmoney_Payment_Gateway_Widget( $zip );
            $zipWidget->render_root_el();
            $zipWidget->render_widget_product();

    Ideally, yes, we’d have a nice Elementor widget which the above could easily be converted in to one.

    HI, Where do we put this code (I am guessing functions.php). And what would the shortcode be? Thanks

    You’d need to wrap that code in a new shortcode if you don’t already have one and, yes, add it to your functions.php file

    add_shortcode('elementor_zip', function() {
        if ( ! class_exists( 'WC_Zipmoney_Payment_Gateway' ) ) {
             return;
        }
        $zip                                     = new WC_Zipmoney_Payment_Gateway();
        $zip->WC_Zipmoney_Payment_Gateway_Config = new WC_Zipmoney_Payment_Gateway_Config( $zip );
        $zipWidget                               = new WC_Zipmoney_Payment_Gateway_Widget( $zip );
        $zipWidget->render_root_el();
        $zipWidget->render_widget_product();
    });

    You could then add the shortcode [elementor_zip] as a Shortcode Widget in Elementor.

    I’ve not tried out this exact example but it will be something like that.

    Thanks for that. unfortunately that doesn’t work (Just tried it on a custom page).

    I’ve just tried it on a site and it worked fine. It is likely the context of what page you’re adding it on i.e. the code above assumes it is on a product single page. If it is is anything else then it likely won’t work due to how the ZIP plugin works out what to show.

    Thanks for that! I just had a play around and got it working (WOOHOO) however it is showing twice (on top of each other).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to integrate with Elementor’ is closed to new replies.