WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Custom Theme - jQuery failing ? (17 posts)

  1. MGKday
    Member
    Posted 1 year ago #

    Hello,

    I am trying to use WooCommerce with a custom theme.

    I could install the plugin successfully.
    I have all the pages working.
    I added a variable product, everything is almost working.

    I did not modify the theme at all for installing WooCommerce.

    Here is the part that doesn't work:

    When I look at a product page, it looks as if jQuery wasn't working:

    -the "Description" and "Additional Information" tabs are both shown (no tab effect), there links are useless since they are already displayed.
    -the product is variable (color and size) was is displayed gives me a hint that jQuery isn't working. indeed I see the "Clear selection" text, without even selecting a color nor a size. and if I select a combination, no "add to cart/quantity" part appears.

    I inspected the page, no JS errors. So I can't debug this.

    I tried using the "woocommerce_content();" trick as in the WC docs, but no changes.

    Any advices ?

    thank you very much in advance.

    MGK

    http://wordpress.org/extend/plugins/woocommerce/

  2. royho
    Member
    Posted 1 year ago #

    It would help if you posted URL...Most likely you have duplicate jQuery running...

  3. MGKday
    Member
    Posted 1 year ago #

    Thanks for your reply royho, I will try to put it online now, as I am running it locally (WAMP) for the moment :/

    I already have jQuery within my theme indeed, everything is working, its just the woocommerce part that is not, and I don't see any JS errors (Chrome > Inspect Element) so I don't really know how to handle that.

    on my function.php's theme, I have

    if ( !function_exists('core_mods') ) {
    		function core_mods() {
    			if ( !is_admin() ) {
    				wp_deregister_script('jquery');
    				wp_register_script('jquery', (get_template_directory_uri()."/js/jquery-1.5.min.js"), false, '1.0');
    
    	wp_enqueue_script('jquery');
  4. royho
    Member
    Posted 1 year ago #

    Again you have to put your site online for us to know...You may not see any errors does not mean we won't see it on our side...

  5. royho
    Member
    Posted 1 year ago #

    Also I am seeing a very old version of jquery being loaded...Could that be the cause?

  6. MGKday
    Member
    Posted 1 year ago #

    I was just uploading everything on my server, sorry for the delay :

    here is a test link :

    http://cultureleb.com/-/

    you can see that jQuery is working by clicking on the + (bottom right), a fake underneath menu will appear

    I changed to latest jQuery 1.8.0 also.

    I even took everything and kept the minimum just for testing purpose.

    Thanks in advance for your help

  7. royho
    Member
    Posted 1 year ago #

    Did you modified the woocommerce template files as well?

  8. royho
    Member
    Posted 1 year ago #

    Looking at your site, you seem to be missing many of the essential scripts thus your site is not working...You're missing jquery UI which makes the TABS function, you're missing add to cart variations JS, add to cart JS...etc...These are needed...

  9. MGKday
    Member
    Posted 1 year ago #

    not at all, the link you see is a clean fresh install of wordpress, my theme and woocomerce plugin. I added the "shop" page on the wordpress menu after installing woocommerce plugin and added a variable product. nothing more.

  10. royho
    Member
    Posted 1 year ago #

    Read my reply.

  11. MGKday
    Member
    Posted 1 year ago #

    so where can I find the "list" of stuff to add when using a custom theme ?

  12. royho
    Member
    Posted 1 year ago #

    Actually these are added by woocommerce plugin...not sure why you don't have them...This is something only you can check as it is your theme...

  13. MGKday
    Member
    Posted 1 year ago #

    maybe I forgot to add a function in my function's theme to say "add all the scripts from the plugins as well" ? does something like that exists ?

  14. royho
    Member
    Posted 1 year ago #

    I doubt it...I would suggest you try another theme...

  15. MGKday
    Member
    Posted 1 year ago #

    when I activate Twenty Eleven for example, it works perfectly.

    so I am guessing you are right, there is something missing on my function.php.

    If you check this page http://cultureleb.com/-/?product=testproduct

    you can see in the source code :

    <script type='text/javascript' src='http://cultureleb.com/-/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js?ver=1.6'></script>

    and so on, which corresponds to the part that are missing in my theme in order to work !

    So now I need to find where does these lines are generated in the Twenty Eleven theme :)

    Am are right ?

    EDIT : resolved, I was calling the footer in another way in my theme,

    I was using

    <?php get_footer(); ?>

    calling the footer.php page, but I needed "wp_footer();"

    it works now, thanks a lot for your help !!

  16. manthono
    Member
    Posted 11 months ago #

    hey MGKday,
    I am having the same problem and would like to get your explanation on how to resolve this. when you say you use wp_footer() instead of <?php get_footer(); ?>, what exactly did you mean/
    How do I modify my theme to apply this trick?
    Is the two function do the exact same thing, so that I can use either one of them?

    thank you

  17. markus74
    Member
    Posted 10 months ago #

    Hi MGKday,

    I don't think wp_footer() is a way to call the footer, but rather it's a hook that most of WooCommerce's scripts are hooked into. Sounds to me like your theme may have been missing this important hook, and when you added it, the missing functionality of WC was restored.

    I wish the solution was that simple for me! I've had exactly the same problem you've described, with the tabs displaying all the content vertically - basically they are not picking up the tab-related Jquery. But I will start a new thread about my own Jquery tab woes! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.