• Hi there,

    Thank you for the great plugin! I just noticed that I am unable to use a link with the type “tel:” as the Add to Cart link. It always adds the http prefix and wraps it up in “window.click” function. I needed to modify the elex-woocommerce-catalog-mode/includes/elex-catalog-mode-admin.php, function elex_cm_redirect_addtocart_product_page to be able to let the link works on my product page.

    Perhaps an ideal would be to add the feature to use other types of hyperlinks, however, an easy solution is to change the following line:

    <button id="elex_prod_btn" class="btn btn-success" style="margin-top: 10px;height: 40px;padding: 0 20px;text-wrap: nowrap" onclick=" window.open('<?php echo esc_html( $suff ) . esc_html( $url_product_page ); ?>','_self')"><?php echo esc_html( $button_text_product_page ); ?></button>

    to:

    <button id="elex_prod_btn" class="btn btn-success" style="margin-top: 10px;height: 40px;padding: 0 20px;text-wrap: nowrap" href="<?php echo esc_html( $url_product_page ); ?>"><?php echo esc_html( $button_text_product_page ); ?></button>

    The same for the shop page too: elex_cm_replace_add_cart_text_shop_with_url

    Thank you very much for your great work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Mohsen Rabieai

    (@mohsenr1)

    or maybe add a filter so we can modify the link by a hook.

    Thread Starter Mohsen Rabieai

    (@mohsenr1)

    I forgot to mention: <button> should be changed to <a>

    Also, it would be great if you can add a body class wrapper to the product pages that has the elex price edits or add to cart button removed.

    I did that by directly adding the following code to elex_cm_redirect_addtocart_product_page function.

            <script type="text/javascript">
    (function() {
    document.addEventListener('DOMContentLoaded', function() {
    var prodDiv = document.getElementById('elex_prod_div');
    if (prodDiv) {
    var body = document.body;
    var customClass = 'elex-custom-class';

    // Check if the body already has the custom class
    if (!body.classList.contains(customClass)) {
    body.classList.add(customClass);
    }
    }
    });
    })();
    </script>
    Plugin Author ELEXtensions

    (@elextensions)

    Hello @mohsenr1, Thank you for sharing your feature requests with us.

    As per the current plugin functionality, the ‘Add to Cart’ button is designed to appear as a button element. Changing it to an anchor tag (<a>) may cause compatibility issues for other users, as this falls outside the plugin’s intended behavior.

    However, we are considering improvements for future versions, including adding a customizable class to the div element, which should provide more flexibility.

    We appreciate your feedback and will keep you updated. Feel free to reach out if you have further questions

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.