Forum Replies Created

Viewing 15 replies - 1 through 15 (of 48 total)
  • @zelenius

    I’m also using the WoodMart theme on three different WooCommerce sites and I haven’t experienced any issues so far with the Viva Smart Checkout plugin.

    There are indeed a few bugs in the plugin that the Viva team should address, but none of them have been serious enough to cause a site crash—at least not in my experience.

    If you’re experiencing a fatal error, I suggest checking the following:

    1. Make sure you haven’t activated the new version of the plugin while the old one is still installed or active. Conflicts between versions could break functionality.
    2. Are you offering a product for free (i.e., a price of “0” or even labeled as “free”)? This could potentially cause unexpected behavior in totals, especially if another plugin modifies how amounts are calculated.
    3. Another plugin may be overriding or applying a filter to order->get_total() or get_order_data(), which could change a numeric value into a string and break formatting.
    4. Check your theme’s functions.php file for any custom code that might be modifying order or checkout values. Even a small customization can sometimes interfere with other plugins.
    5. The site might be using a number format with commas (e.g. “10,99”) instead of periods (“10.99”), and the plugin could be receiving a string that’s not properly converted to a float. Regional/language settings or other plugins might be affecting this.

    Hope this helps!


    @zelenius What’s your PHP version?

    @bobbivd Are you using Cloudflare for your site?

    Plugin Author headplus

    (@headplus)

    Thank you! 🙂

    Thread Starter headplus

    (@headplus)

    Σας παραθέτω 2 βελτιωμένες αντικαταστάσεις σε 2 functions του κώδικα σας που πιθανόν να βρείτε χρήσιμα:

    public function get_order_weight()
    {
        $chosen_methods = WC()->session->get('chosen_shipping_methods');
        $weight = 0;
    
        foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
            $_product = $cart_item['data'];
    
            if (is_numeric($_product->get_weight())) {
                $weight += $_product->get_weight() * $cart_item['quantity'];
            }
        }
    
        return $weight;
    }
    public function calculate_shipping($packages = array())
    {
        $settings = AcsPointsPlugin::getSettings();
        $baseCost = $settings['baseCost'];
        $baseCostKgLimit = $settings['baseCostKgLimit'] ?? 0;
        $costPerKg = $settings['costPerKg'] ?? 0;
    
        $freeShippingLimit = $settings['freeShippingUpperLimit'];
        $optionCost = 0;
    
        $orderTotalCost = 0;
        $weightTotal = 0;
    
        foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
            $_product = $cart_item['data'];
            $qty = $cart_item['quantity'] ?? 1;
            $tempWeight = (float) $_product->get_weight(); // Changed to float for decimal weights
            $weightTotal += $qty * $tempWeight;
            $orderTotalCost += $qty * $_product->get_price();
        }
    
        if ($freeShippingLimit != '' && $orderTotalCost < $freeShippingLimit) {
            $optionCost = $baseCost;
            if ($weightTotal > $baseCostKgLimit) {
                $optionCost += $costPerKg * ($weightTotal - $baseCostKgLimit);
            }
        }
    

    Στον 1ο ενημερωμένο κώδικα, η συνάρτηση επαναλαμβάνεται πάνω από τα είδη καλαθιού χρησιμοποιώντας WC()->cart->get_cart() και υπολογίζει το βάρος με βάση το βάρος κάθε προϊόντος πολλαπλασιασμένο με την ποσότητα του. Η μέθοδος get_cart_contents_weight() που παρέχεται από το WooCommerce υπολογίζει το συνολικό βάρος των περιεχομένων του καλαθιού, γεγονός που καθιστά τον κώδικα πιο συνοπτικό και εξαλείφει την ανάγκη ανάκτησης πακέτων από την κατηγορία αποστολής.

    Στον 2ο ενημερωμένο κώδικα, η συνάρτηση χρησιμοποιεί WC()->cart->get_cart() για να επαναλάβει τα είδη του καλαθιού και υπολογίζει το συνολικό βάρος και το συνολικό κόστος παραγγελίας με βάση την ποσότητα και το βάρος κάθε προϊόντος. Πολλαπλασιάζοντας το $tempWeight με το $qty στη γραμμή $weightTotal += $qty * $tempWeight;, ο υπολογισμός λαμβάνει σωστά υπόψη την ποσότητα κάθε προϊόντος και συσσωρεύει το συνολικό βάρος ανάλογα. Η ανάγκη πρόσβασης στα $packages[‘contents’] εξαλείφεται.

    Όσοι αντιμέτωπίζουν προβλήματα υπολογισμού (δοκιμασμένα με την έκδοση 6.0.5 ) προτέινω να προχωρήσουν σε αντικατάσταση με των άνω Functions.

    Ευελπιστώ οι προτάσεις μου να φανούν χρήσιμες.

    Σας ευχαριστώ για την ανάγνωση

    • This reply was modified 2 years, 11 months ago by headplus.
    • This reply was modified 2 years, 11 months ago by headplus.
    Thread Starter headplus

    (@headplus)

    Θα ήθελα συμπληρωματικά να σας προτείνω αν μου επιτρέπετε, έπειτα απο μιά γρήγορη ματιά στον κώδικα σας, να επαναδιατυπώσετε τον κώδικα στο τρόπο υπολογισμού σε ολες στις περιπτώσεις βάρους χρησιμοποιώντας πιο απλά στα functions το WC()->cart->get_cart_contents_weight(); έναντι αυτών χρήζουν διόρθωσεις.

    Thread Starter headplus

    (@headplus)

    Τα points εμφανίζονται κανονικά. Όταν γίνεται προσπάθεια κάποιας επιλογής point όμως δεν ανοίγει κάποιο παράθυρο για την επιλογή του, ούτε φυσικά απομνημονευεται με κάποιο τροπο ώστε να προχωρήσει το checkout με την επιλογή του point.

    Tα console errors που βλέπω είναι :

    1.You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.

    2.invalidValueError: setCenter: not a LatLng or LatLngLiteral with finite coordinates: in property lng: not a number

    3.InfoWindow.open() was called without an associated Map or StreetViewPanorama instance.

    Thread Starter headplus

    (@headplus)

    hello! @wfjoshc Thank you for your reply!

    firstly I would like to mention that the function “bot fight” is able to be disabled very easily in Cloudflare and as you can imagine i tried it (with bot fight disabled). But never the scan worked!

    But i have GOOD NEWS and I solved my problems!!!

    I threw Wordfence in the trash and i replaced it with another valuable plugin that does not cause me any problems either with my local server or with Cloudflare etc.


    I hope in the future the tech team of WF manage to solve the problems that plugin has either in friendliness with Cloudflare or any other Firewall, either regarding the newer php etc.

    So…becouse time is money, (and please believe me, i have offer lot on Wordfence,)

    if someone has same problems mustn’t forget that he can use the Trush!


    Thank you again for your replies and for your time!

    Thread Starter headplus

    (@headplus)

    hello! @wfjoshc

    instructions that we use for Cloudflare with Central here: https://www.wordfence.com/help/central/connect/

    I Think that the wordfense team has to update the instructions for Cloudflare because cloudlfare has changed some setting.

    This might be “bot fight” mode.

    You can take a look at my settings about that:

    https://ibb.co/ftSZbRf

    https://ibb.co/VHjFhF3

    So as you can see i think that with these settings wordfence scan would must work..but it doesnt….

    so now what do you think that is going wrong after the email that i sent and screenshoots here?

    Thread Starter headplus

    (@headplus)

    @wfjoshc I just sent it!

    Thread Starter headplus

    (@headplus)

    Hi @wfjoshc,

    On Cloudflare settings Rate limiting rules section. shows: “No data”

    On Firewall rules i have 2 rules. the first is for my ip (and there are activities with some events from my site’s cronjob), and the second has the Wordfence’s servers ips as “allow” that there is no any avtivity(means no data on log).

    Thread Starter headplus

    (@headplus)

    Thank you for your reply.

    As you know cloudflare has many options and setting. Would you like to be more detailed about that?

    Thread Starter headplus

    (@headplus)

    hi again!
    i tried the new version 1.0.5 and it seems that works perfect now!
    Good job!!!!

    Thread Starter headplus

    (@headplus)

    sure! here is a screenshoot:

    https://ibb.co/FBWFN1M

    Thread Starter headplus

    (@headplus)

    it sounds nice! Good job!

    i updated and i tried it but i think that there is a coonflict with the plugin woocomerce cost of goods on columns. Please cheack it , becouse i dont know if it is my problem or generally .

Viewing 15 replies - 1 through 15 (of 48 total)