• Resolved Fabian

    (@fabeylous)


    Hi there,

    We are using the Enfold theme, and Wishlist and Compare from you.

    It’s working perfectly when logged in, but logged out, the do_shortcodes won’t work.

    We do not have any caching plugins activated.

    We are using the shortcodes in a product grid, and also in a slider, but as I said, they only work logged in. I can’t seem to understand why.

    These are my snippets:

    Grid:

    #child-theme/woocommerce/content-product.php
    # (previous code) 
    global $product;
    # ...
    ?>
    						<div class="tag-wrapper">
    	                         <?php echo apply_filters( 'the_content',' [yith_compare_button] ');
    <?php
    # (rest of the code)

    Slider: (same link, but (url)/shop-startseite/)

    # ...
    
    				$html .= do_shortcode( '[yith_wcwl_add_to_wishlist product_id="' . $product->get_id() . '"]', false );
    # ...

    They both work perfectly logged in, but not logged out, so I guess it’s not an issue within the code itself.

    Can you guys help me out here?
    Thanks in advance!

    • This topic was modified 1 year, 1 month ago by Fabian.
    • This topic was modified 1 year, 1 month ago by Fabian.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    Regarding the Compare problem, I recommend opening a topic dedicated to it.

    Regarding Wishlist, try adding the following code into the functions.php file of your active child theme:

    if (defined('YITH_WCWL')) {
        if (!function_exists('yith_wcwl_enqueue_back_required_assets')) {
            function yith_wcwl_enqueue_back_required_assets()
            {
                $suffix  = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
                $version = defined('WC_VERSION') ? WC_VERSION : '';
    
                wp_enqueue_style('woocommerce_prettyPhoto_css', plugins_url('assets/css/prettyPhoto.css', WC_PLUGIN_FILE), array(), $version);
                wp_enqueue_script('prettyPhoto', plugins_url('assets/js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', WC_PLUGIN_FILE), array('jquery'), '3.1.6');
                wp_enqueue_script('prettyPhoto-init', plugins_url('assets/js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', WC_PLUGIN_FILE), array('jquery'), $version);
    
    
                wp_enqueue_style('yith-wcwl-main', YITH_WCWL_URL . 'assets/css/style.css', array('jquery-selectBox'));
            }
            add_action( 'wp_enqueue_scripts', 'yith_wcwl_enqueue_back_required_assets', 9999 );
        }
    }

    Check it out and tell us any news, please.

    Best regards.

    Thread Starter Fabian

    (@fabeylous)

    Hi Juan,

    sadly, that didn’t work. I noticed you can see the icons when adding parameters to the URL, but we definitely do not have any caching plugins activated, eventhough those “symptoms” clearly sound like a caching problem.
    The server also does not cache.
    Do you have an idea?

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hi Fabian,

    Currently I don’t see that you have our plugin active. Could you activate it please? In this way we will visit the link that you shared with us to see the problem.

    Did you try activating/disabling AJAX loading?

    Did you try leaving only WooCommerce and our plugin active, and a default WordPress theme like 2023?

    Let us know any news.

    Best regards.

    Thread Starter Fabian

    (@fabeylous)

    Hi Juan,

    the plugin is active, we never deactivated it. This is part of the problem.
    When you add a parameter to the link, the shortcodes will get executed. Otherwise, they’re just getting displayed plain text.

    I tried deactivating AJAX, but that didn’t help.


    We have a very customized plugin and theme, which won’t allow deactivating everything besides woocommerce and YITH, so that is not a thing we can test. I’m just going to break my page.

    Do you have any ideas?

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello Fabian,

    In that case, I recommend testing on a staging site, which you can easily create using the free WP Staging plugin.

    Let us know any news.

    Best regards.

    Thread Starter Fabian

    (@fabeylous)

    Hi Juan,

    I’ve changed the URL, then it worked for a bit. But now, it is not working again. I can’t keep changing URLs to fix this.

    I’ve cleaned and deactivated all the plugins, same result.

    I’ve cleaned the whole child theme with only the style.css active, same result.

    I’m really struggling here.

    Thread Starter Fabian

    (@fabeylous)

    Hi Juan,

    I finally found the problem.

    Its a plugin conflict, which still worked after deactivating the plugin.

    It’s the plugin “Plugin Organizer”, which stops loading some plugins on certain pages (hence it will work logged in and with a parameter, since its a new URL or an exception for logged in users).
    Finally solved it. Thank you for your time.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Do Shortcode not working when not logged in’ is closed to new replies.