Home Forums WoodMart support forum Replace add to cart button with JS

Replace add to cart button with JS

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #544042

    v1ppers0nn
    Participant

    Hi, i want to remove the “a href” of the “add to cart” button, because this generate thousand of links. For example:
    https://magherbs.com/problemi-i-zabolyavaniya/bolki-v-stavite/?add-to-cart=28843
    https://magherbs.com/hranitelni-dobavki/lipozomni/?add-to-cart=28843
    https://magherbs.com/?add-to-cart=28843

    This is really bad for SEO.

    Is possible to make the add to cart with JS or data-href?

    #544249

    Hung Pham
    Keymaster

    Hi v1ppers0nn,

    Thanks for reaching to us.

    Do you want to remove this part of href tag https://prnt.sc/cBCxLbnnrBbA?

    If so, then you can’t add product to the cart.

    Regards,

    #544284

    v1ppers0nn
    Participant

    Can you help me to make this:

    There are many options for hiding external links, one of them is Clever Hide. This is an intuitive way through which without using Base64 or other decoders given links are available to users but not considered links from robots.

    1. Placing a hidden link.

    2. The link in the page is placed as follows:
    <span class=”clever-link”
    data-link=”http://anylink.com>”>anylink.com</span&gt;

    3. Paste the JS loader code.
    JavaScript code that needs to be loaded after loading the The DOM tree:

    $(document).ready(function() {
    $(‘.clever-link’).click(function(){window.open($(this).data(‘link’),
    “_self”);return false;});
    });

    This is an example based on the jQuery library. This feature should to be loaded on any page that contains span elements with a class clever-link.

    It is important that the function loads after all are fully loaded HTML elements.

    4. Setting the CSS style for the correct visualization.

    In order for the span element to appear as a link, it needs to be added the following CSS style:

    span.clever-link {
    text-decoration: underline;
    cursor: pointer;
    /* other link styling to match site design */
    }

    5. Additional clarifications.
    It actually represents a simple span element which on click performs a JavaScript redirect to an element.

    Final goal:
    The link is available to users but invisible to bots
    search engines

    • This reply was modified 1 year ago by v1ppers0nn.
    #544516

    Hung Pham
    Keymaster

    Hi v1ppers0nn,

    Changing like this would require complicated customization, which is out of basic support. Thanks for understanding our limitation.

    Regards,

    #544537

    v1ppers0nn
    Participant

    Can you give me a price for this customization?

    #544593

    Hung Pham
    Keymaster

    Hi v1ppers0nn,

    Currently, we do not offer customization.

    Thanks for your understanding.

    Regards,

    #544599

    v1ppers0nn
    Participant

    So how can i delete completly the button in the category pages? Not hide it with CSS.

    #544671

    Hung Pham
    Keymaster

    Hi v1ppers0nn,

    Unfortunately, it is not possible. Such modification requires complicated of changing HTML structure Woocommerce code customization which is not covered by our support.

    Best Regards.

    #546219

    v1ppers0nn
    Participant

    Hi, i found an method to change the url of add to cart, but i cant make it on the homepage. Do you know what is the tag for homepage? I am usign this:
    add_filter(‘woocommerce_is_purchasable’, ‘hide_add_to_cart_category’, 99 );

    function hide_add_to_cart_category ($hide) {

    //short-hand version
    //return $hide = is_product_category() ? false : true;

    if ( is_product_category() || is_shop()) {
    $hide = false;
    } else {
    $hide = true;
    }

    return $hide;
    }

    Is working on category pages, but i want also in homepage.

    Thanks.

    #546595

    Hung Pham
    Keymaster

    Hi v1ppers0nn,

    Thanks for your patience.

    According to the code, I see it currently applies to Shop and Product categories page. However, customization is out of our support scope. Please contact who wrote this code for further assistance.

    Thanks for your understanding.

    Best Regards.

Viewing 10 posts - 1 through 10 (of 10 total)