• Resolved jazura

    (@jazura)


    Hello,

    Your plugin looks fantastic. But I can’t get it to work on my site.
    (I followed all the details in the movies and comments for settings, minimal price, etc)

    As soon as I select “display custom options” and “enable price calculation” in settings, the price goes to 0 and stays there. Whatever I do, the price remains 0 (which is not the default price of 25)

    In the console I notice this error:
    Uncaught TypeError: e.productFormEl.parsley(…).validate is not a function
    at Object.processFormData (frontend.js?ver=4.7.7:1)
    at frontend.js?ver=4.7.7:1

    This error is thrown every time the price should be calculated (so, for example, when opening the product page of everytime I change the input parameter ‘inputlabel’)

    See screenshot:
    https://pasteboard.co/JaWo6Rh.png

    Any suggestions ?

    Best regards

    Peter

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author moomooagency

    (@moomooagency)

    Hi Peter,

    Try to switch to default theme (e.g. Storefront) and deactivate all plugins except WC and UniCPO and then check this issue. Seems it is compatibility issue.

    Thread Starter jazura

    (@jazura)

    Thanks. After trying out lots of things, it seems the culprit is not really another plugin or theme. It’s an extra code snippet in the functions.php :

    add_action( 'woocommerce_after_shop_loop_item', 'my_woocommerce_template_loop_add_to_cart', 10 );
    
    function my_woocommerce_template_loop_add_to_cart() {
    
        echo '<form action="' . get_permalink() . '" method="get">
                <button type="submit" class="button product_type_simple add_to_cart_button ajax_add_to_cart kad-btn headerfont kad_add_to_cart" style="width: 100%;">','More Info', '</button>
              </form>';
    }

    The thing that puzzles me is the fact that this should have no effect on the single product page. The code adds a ‘more info’ button to the products in the category view (like the shop pages).

    Even stranger: even if I explicitly state that the code should not run on the specific single product page with the price calculation, it has no effect.

    Any ideas why this very small piece of code is messing up uni cpo?
    (I’ve been using this snippet for years)

    Best

    Peter

    • This reply was modified 4 years, 9 months ago by jazura.
    • This reply was modified 4 years, 9 months ago by jazura.
    • This reply was modified 4 years, 9 months ago by jazura.
    Plugin Author moomooagency

    (@moomooagency)

    This is the form, not just button. And it probably adds product to the cart.

    Thread Starter jazura

    (@jazura)

    Well, no. The point of the button is to direct the user to the single product page instead of adding the product to the cart.

    But anyway, I found the solution. Simply omitting ‘product_type_simple’ from the list of classes.

    Plugin Author moomooagency

    (@moomooagency)

    Then it is too much for ‘just a button’. There is a ‘form’ tag, your button is inside it and has type ‘submit’. It submits data via the form. Why? I don’t know. You could just use ‘a’ tag and redirect users to the product page. Why so much complexity?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘price not calculated – uncaught type error’ is closed to new replies.