• Resolved Kleor

    (@kleor)


    When I click on the “Validate” button right next to the points in the order page or the cart page, nothing happens. The problem persists when I punctually deactivate all plugins except WooCommerce and MyRewards, and when I punctually activate the Twenty Twenty One theme instead of the current theme.

    I’ve disabled the plugin until this issue is resolved, because if people see that they can theoretically get a discount, but it actually doesn’t work, they won’t complete their order.

    I use the version 4.6.2.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Long Watch Studio

    (@lwsdevelopers)

    Hello,

    There’s no “Validate” button on the points on cart tool. There’s a “Use Max Amount” button and an “Apply” button.
    Both require that you have at least some points to use on the cart.
    If you click the “Use Max Amount” button, it should use all your points and set a discount.
    If you want to use a custom amount of points, you need to input the number of points to use first and, only after that, click the “Apply” button. The “Apply” button will stay grayed out until there’s more than one point in the input area.

    Does it help you with your problem ?

    Thread Starter Kleor

    (@kleor)

    I have 2331 points, but nothing happens when I click the “Use Max Amount” button. I can enter a number in the input area, but even with at least one point in this area, nothing happens when I click the “Apply” button. Maybe you can tell me what I need to replace XXXXX with in this code to make it work:

    <script>
    inputs = document.querySelectorAll("input.lws_wr_pointsoncart_amount_value");
    inputs.forEach((input) => { if (input.getAttribute("name") == "lws_wr_pointsoncart_amount_value") { points_input = input; data_usemax = input.getAttribute("data-usemax"); } });
    
    buttons = document.querySelectorAll("button.lwss_selectable");
    buttons.forEach((button) => {
    button.disabled = false;
    data_id = button.getAttribute("data-id");
    if (data_id == "lws_woorewards_points_to_cart_action_max") { use_max_amount_button = button; }
    if (data_id == "lws_woorewards_points_to_cart_action_update") { apply_points_button = button; }
    });
    use_max_amount_button.setAttribute("onclick", "points_input.value = data_usemax;");
    apply_points_button.setAttribute("onclick", "XXXXX");
    </script>

    Even, if it’s a PHP function instead of a JavaScript code, it’s not a problem because I know how to make an AJAX request.

    Plugin Author Long Watch Studio

    (@lwsdevelopers)

    Hello,

    You shouldn’t input custom code for the points on cart feature to work.
    I made the test on 3 different websites this morning with version 4.6.2 and both buttons worked on all of them.
    What you can verify is that the pointsoncart.js file is loaded on your cart/checkout page and you can add some console.log instructions to see if it’s called correctly when you click on one of the buttons.

    Thread Starter Kleor

    (@kleor)

    Thank you for your quick answer! Indeed, this file wasn’t loaded in the page, so I added this code:

    <script src="/wp-content/plugins/woorewards/js/pointsoncart.js"></script>

    and now it works! ??

    Plugin Author Long Watch Studio

    (@lwsdevelopers)

    Glad you could work it out.
    Good luck with your loyalty program.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Nothing happens when I click on the “Validate” button’ is closed to new replies.