Forum Replies Created

Viewing 15 replies - 46 through 60 (of 75 total)
  • Thread Starter intolap

    (@intolap)

    By mistake, I marked it as resolved.

    Thank you for your reply. I figured out the issue. It was the website where the woocommerce function WC()->checkout not working. So, I did that using a different approach.

    Then I found that the plugin settings not saving/ updating if I make it support the shipping zone. When I use it as the global shipping method, it just works fine.

    https://www.codepile.net/pile/z38kaX9j

    Thread Starter intolap

    (@intolap)

    Hello @laceyrod,

    Now I am facing another issue.

    My custom shipping method supports zones.

    $this->supports = array(
    ‘shipping-zones’,
    ‘instance-settings’,
    ‘instance-settings-modal’,
    );

    When I add this shipping method to a zone. This is not updating the settings if I make any changes https://www.peopleperhour.com/web/aHR0cHM6Ly93d3cubG9vbS5jb20vc2hhcmUvNGMzN2IxYjBlYjNjNDc5ZGFkYTBiZmFkZDAxMWViMGE%3D

    Any clue why this issue?

    Regards,
    Debashis

    Thread Starter intolap

    (@intolap)

    This is resolved.

    Thread Starter intolap

    (@intolap)

    Hello @laceyrod,

    I managed to debug the issue. But I have a question.

    In my custom shipping plugin “calculate_shipping()” function, I need the billing_first_name, billing_last_name, billing_phone. I am able to get these details using –

    WC()->checkout->get_value(‘billing_first_name’)
    WC()->checkout->get_value(‘billing_last_name’)
    WC()->checkout->get_value(‘billing_phone’)

    I tried using,

    WC()->session->get_value(‘billing_first_name’)
    WC()->session->get_value(‘billing_last_name’)
    WC()->session->get_value(‘billing_phone’)

    The above works when I am a returning customer and logged in. But the same doesn’t work when I am a new customer and is not logged in.

    I just need the three form field values regardless of the login or logout state of the customer. Can you please help?

    Best regards,
    Debashis

    Thread Starter intolap

    (@intolap)

    Hello Team,

    Any update?

    I dig more into the situation and noticed one pattern.

    In calculate_shipping() function I am fetching the shipping cost via an API. So, showing the cost on the checkout page is all good. But when I select that shipping method and place an order this issue occurs.

    Putting some intermediary logging, I found a strange behavior defined below.

    On checkout page: Makes the API call and shows the shipping fee.

    (Log says)
    2021-01-19T12:27:54+00:00 INFO {“totalFee”:”12.00″,”totalFeeCurrency”:”SGD”}

    After placing an order: Makes the API call again but fails because it does not find the billing name and phone (required by the API).

    (Log says)
    2021-01-19T12:28:20+00:00 INFO {“message”:”ERR_REQUIRED_FIELD”,”detail”:”Failed to validate data: validator 0xc01cfa6ed0 failed: object property ‘deliveries’ validation failed: object property ‘toContact’ validation failed: object property ‘name’ validation failed: string ” does not match regular expression ‘.+'”}

    Hence it falls back to the other available shipping method in the list to complete the order.

    Can you please explain why woocommerce doesn’t find the checkout fields (name and phone) when the order is placed?

    Eagerly looking forward to a response.

    Best regards,
    Debashis

    Thread Starter intolap

    (@intolap)

    Hello,

    I have already shared the error. That is exactly logged in the wc log.

    Thread Starter intolap

    (@intolap)

    Hello @laceyrod,

    Unfortunately, I have not received any response from the woocommerce slack community yet. Any other suggestions?

    Best regards,
    Debashis

    Thread Starter intolap

    (@intolap)

    Hello @laceyrod,

    Yes, you are correct.

    I find it strange that the issue happens when we assign the cost to the add_rate function. Actually I am fetching the shipping rates from an API which returns JSON response {“totalFee”:”15″,”totalFeeCurrency”:”SGD”}

    Now, when I json_decode this response and assign the totalFee to the cost, it does not accept.

    Doesn’t work:
    $response = json_decode({“totalFee”:”15″,”totalFeeCurrency”:”SGD”}, true);
    $cost = $response[‘totalFee’]; // I tried intval(), floatval(), strval()

    $rate = array(
    ‘id’ => $this->id,
    ‘label’ => $this->title,
    ‘cost’ => $cost
    );
    $this->add_rate($rate);

    Works:
    $rate = array(
    ‘id’ => $this->id,
    ‘label’ => $this->title,
    ‘cost’ => 10
    );
    $this->add_rate($rate);

    –OR–
    $cost = 10;
    $rate = array(
    ‘id’ => $this->id,
    ‘label’ => $this->title,
    ‘cost’ => $cost
    );
    $this->add_rate($rate);

    Hope this gives a vision of where I am doing wrong.

    Best Regards,
    Debashis

    • This reply was modified 4 years, 1 month ago by intolap.
    Thread Starter intolap

    (@intolap)

    Hello @laceyrod,

    Thank you for your prompt response. The site already has a zone for Singapore with a Local pickup method in it. I just added a custom shipping method, tried both global and zone variation. But every time I select the custom shipping on the checkout page, the order always saves as a Local pickup method.

    To cross-check I tried the skeleton shipping method define where https://docs.woocommerce.com/document/shipping-method-api/ but I face the same issue. I have followed the exact guidelines laid down by Woocommerce to create my shipping method. I have developed several shipping methods before following the same guidelines but never faced this issue.

    Just to emphasize, calculate_shipping() is working perfectly and so I am able to select my custom shipping method on the checkout page. On selecting the cart total also updates. But after placing the order finally, the order saves Local pickup.

    That’s it!

    How do you want me to share the codes to check? Here or on the other channels you mentioned?

    Best regards,
    Debashis

    On activation, I see this.

    The plugin generated 233 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    On the front end, click on the button, I see this…

    Uncaught Error: Invalid options
    at $ (checkout.js:1)
    at new jt (checkout.js:1)
    at openCheckout ((index):243)
    at Object.success ((index):236)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at x (jquery.js:4)
    at XMLHttpRequest.c (jquery.js:4)

    Note: I tried isolating the Razorpay plugin with 2020 theme but the same above issue.

    Additionally, when I deactivated all the plugins except RZP along with 2020 theme.

    I see this…

    Uncaught ReferenceError: jQuery is not defined

    Hello,

    After installing and activating the latest version of the plugin, I see the below error.

    wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/public_html/sitename.in/wp-includes/functions.php on line 5225

    Trying to debug the issue, I have replaced the line add_action(‘plugins_loaded’, ‘wordpressRazorpayInit’, 0); with add_action(‘init’, ‘wordpressRazorpayInit’, 0); on the main plugin file at the root.

    But regardless of the change, I see another issue when clicked on the Pay with Razorpay button generated by the shortcode. The error is:

    Uncaught Error: Invalid options
    at $ (checkout.js:1)
    at new jt (checkout.js:1)
    at openCheckout ((index):222)
    at Object.success ((index):215)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at x (jquery.js:4)
    at XMLHttpRequest.c (jquery.js:4)

    To verify if the checkout.js has any issue, I integrated the Razorpay manual checkout using the GitHub library, it is working fine.

    Hope you can help.

    Replace add_action(‘plugins_loaded’, ‘wordpressRazorpayInit’, 0); with add_action(‘init’, ‘wordpressRazorpayInit’, 0); turns off the issue. But I am seeing another issue, I doubt this has to do with their checkout.js

    Uncaught Error: Invalid options
    at $ (checkout.js:1)
    at new jt (checkout.js:1)
    at openCheckout ((index):222)
    at Object.success ((index):215)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at x (jquery.js:4)
    at XMLHttpRequest.c (jquery.js:4)

    We also faced this issue in one of our client’s projects. Seems the developer is not responsive on this thread.

    Kindly inform me if you have found any solution to this.

    Plugin Author intolap

    (@intolap)

    Hello Alnahari Tech,

    We have updated the plugin with some validation fixes including the one you mentioned. Hope this solves your problem.

    Best regards,
    Debashis

    Plugin Author intolap

    (@intolap)

    Hello Alnahari Tech,

    We have updated the plugin with translation capability along with some other validation fixes. Hope this solves your problem.

    Best regards,
    Debashis

Viewing 15 replies - 46 through 60 (of 75 total)