Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #2769568
Javascript console error
Closed

Comments

  • yılmaz started the conversation

    Hi Team,

    Uncaught Error: Syntax error, unrecognized expression: .wooscp-btn-{product id}

    here is how I use it : 

    do_shortcode('[wooscp id="'.$product->get_id().'"] )

    do_shortcode('[wooscp]' );

    do_shortcode('[woosc]' );

    In all three cases, an error occurs in the console

    Thank you in advance for your interest

  •  767
    Janilyn replied

    Hi Yilmaz,

    Thank you for contacting WPClever Support Forum. 

    We’ve received your ticket and assigned one of our developers to help you with that. He’ll be looking into your issue and responding as soon as finding a solution. 

    Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back.

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  1,222
    Dustin replied

    Hi Yilmaz,

    #1. If you want to place the compare button on a single product page, please use the below code:

    echo do_shortcode('[woosc]');

    #2. If you want to place it at the custom position, please provide the product ID:

    echo do_shortcode('[woosc id="{product_id}"]');

    E.g:

    echo do_shortcode('[woosc id="99"]');

    If you already have the product ID stored in a variable $product_id, you also can use the code:

    echo do_shortcode('[woosc id="'. $product_id .'"]');

    Best regards,
    Dustin

  • yılmaz replied

    Hi Dustin,

    Thanks for feedback,

    I'm trying to use this shortcode in a loop, I tried this code you gave but nothing changed

    jquery.min.js?ver=3.5.1:2 Uncaught Error: Syntax error, unrecognized expression: .wooscp-btn-{product id}
        at Function.se.error (jquery.min.js?ver=3.5.1:2)
        at se.tokenize (jquery.min.js?ver=3.5.1:2)
        at se.select (jquery.min.js?ver=3.5.1:2)
        at Function.se (jquery.min.js?ver=3.5.1:2)
        at Function.s.find (jquery-migrate.min.js?ver=3.3.2:2)
        at S.fn.init.find (jquery.min.js?ver=3.5.1:2)
        at s.fn.init.S.fn.init (jquery.min.js?ver=3.5.1:2)
        at new s.fn.init (jquery-migrate.min.js?ver=3.3.2:2)
        at S (jquery.min.js?ver=3.5.1:2)
        at frontend.js?ver=3.5.5:489
    

    here is my code 

    $args = array(
                'post_type' => 'product',
                'posts_per_page' => $s['post_per_page'],
                'post__in' => $s['post_include'],
                'post__not_in' => $s['post_exclude'],
                'order' => $s['order']
            );
    $the_query = new \WP_Query( $args );
    if ( $the_query->have_posts() ) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $product = new \WC_Product( get_the_ID() );
            $product_id = $product->get_id();
            echo do_shortcode('[woosc id="'.$product_id.'"]');
    }
    }
    

    other scenerio

    global $product;
    ?>
    <div class="exclusive-item exclusive-item-three text-center mb-50">
        <div class="exclusive-item-thumb">
            <?php do_action( 'venam_loop_product_thumb' ); ?>
            <?php do_action( 'venam_loop_product_buttons' ); ?>
            <?php echo do_shortcode('[woosc id="'.$product->get_id().'"]'); ?>
        </div>
    </div>
    

    other scenerio

    $the_query = new \WP_Query( $args );
            if ( $the_query->have_posts() ) {
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    $product = new \WC_Product( get_the_ID() );
                    $saving = '';
                    if ( 'yes' != $s['hidesave'] && $product->is_on_sale() && ! $product->is_type('variable') ) {
                        $regular = (float) $product->get_regular_price();
                        $sale = (float) $product->get_sale_price();
                        $saving = $regular && $sale ? round( 100 - ( $sale / $regular * 100 ), 1 ) . '%' : '';
                        $saving = $saving ? '<span class="save--price">{ '.$saving.' '.$s['save_after'].' }</span>' : '';
                    }
                    $price_before = $s['price_before'] ? $s['price_before'].' ' : '';
                    $html .= '<div class="col">';
                        $html .= '<div class="super-deals-item text-center mb-55">';
                            $html .= '<div class="super-deal-thumb mb-25">';
                                $html .= 'yes' != $s['hidesale'] ? venam_product_badge() : '';
                                $html .= '<a href="'.get_permalink().'">'.get_the_post_thumbnail( get_the_ID(), $size ).'</a>';
                                $html .= '<div class="button-actions">';
                                    $html .= do_shortcode('[woosc id="'.$product->get_id().'"]');
                                $html .= '</div>';
                            $html .= '</div>';
                            $html .= '<div class="super-deal-content">';
                                $html .= '<h6><a href="'.get_permalink().'">'.get_the_title().'</a></h6>';
                                $html .= '<p>'.$price_before.wc_price($product->get_price()).$saving.'</p>';
                            $html .= '</div>';
                        $html .= '</div>';
                    $html .= '</div>';
                }
            }
            wp_reset_postdata();
            return $html;
    

    I'm working on a new wp theme, I'm thinking of using your plugins instead of yith plugins, but I need to fix this problem

    FYI: I want you to know that I have cleared my browser cache

    hope you can help

    Thanks

  •  1,222
    Dustin replied

    So strangefrown.png

    Please send me your website info (wp-admin link, username, password) then I can check and fix this problem for you. You also can create a dev/staging site with the same issue then I'll work on it.

    Best regards,
    Dustin

  • yılmaz replied

    thank you for everything, my problem is solved, you can close this ticket

    have nice day:)

  •  1,222
    Dustin replied

    You're welcome!smile.png

    Feel free to submit a new ticket if you have any questions when using our plugin.

    Best regards,
    Dustin

  • yılmaz replied

    Sorry to be late noticing your extensions and the great things your team is doing, great plugins and great support team, what else can I ask!

    Have a nice day:)