ResolvedLafka not compatible with “Local Delivery Drivers for Magazin”

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #37260
    ionutionut95
    Participant

    Hello

    Unfortunately, lafka theme has a bug that hasn’t fixed yet.

    This is the issue with the lafka plugin, please send it to their support:

    This is the error that deletes the products in cart:

    get_cart was called incorrectly. Get cart should not be called before the wp_loaded action. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, do_action(‘woocommerce_init’), WP_Hook->do_action, WP_Hook->apply_filters, LDDFW_Admin->lddfw_shipping_settings__premium_only, WooCommerce->__get, WooCommerce->shipping, WC_Shipping::instance, WC_Shipping->__construct, WC_Shipping->init, do_action(‘woocommerce_shipping_init’), WP_Hook->do_action, WP_Hook->apply_filters, Lafka_Shipping_Areas::clear_wc_shipping_rates_cache, WC_Cart->get_shipping_packages, WC_Cart->get_items_needing_shipping, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.

    This is the function:
    public static function clear_wc_shipping_rates_cache() {
    if ( isset( WC()->cart ) ) {
    $packages = WC()->cart->get_shipping_packages();
    foreach ( $packages as $package_key => $package ) {
    WC()->session->set( ‘shipping_for_package_’ . $package_key, false ); // Or true
    }
    }
    }

    Kind regards
    Roy

    #37274
    Alex
    Keymaster

    Hello ionutionut95,

    Yes, this function may cause issues with some other plugins. The function is there so the shipping price based on distance functionality to work correctly.
    If you are not using this option, you can remove the action which triggers it.

    You can add following code in your child theme’s functions.php to remove it:
    remove_action( 'woocommerce_shipping_init', array( 'Lafka_Shipping_Areas', 'clear_wc_shipping_rates_cache' ) );

    Regards,
    Alex

    #37278
    ionutionut95
    Participant

    This solution is not working. The theme is still buggy with the plugin I paid.

    #37281
    Alex
    Keymaster

    Hello ionutionut95,

    Then probably this is not reason.

    What exactly is the issue you have?

    Regards,
    Alex

    #37288
    ionutionut95
    Participant

    When I have the plugin installed, I am not able to add products to the cart. Somehow the javascript is not saving the products in the chart.

    #37298
    ionutionut95
    Participant

    The Local Delivery rivers for Magazin team solved this issue for me.

    Sure, try this
    Find the function on lafka plugin, in the folder lafaka shipping areas

    public static function clear_wc_shipping_rates_cache() {
    if ( isset( WC()->cart ) ) {
    $packages = WC()->cart->get_shipping_packages();
    foreach ( $packages as $package_key => $package ) {
    WC()->session->set( ‘shipping_for_package_’ . $package_key, false ); // Or true
    }
    }
    }

    and replace it with the following function

    public static function clear_wc_shipping_rates_cache() {
    add_action( ‘wp_loaded’, function() {
    if ( isset( WC()->cart ) ) {
    $packages = WC()->cart->get_shipping_packages();
    foreach ( $packages as $package_key => $package ) {
    WC()->session->set( ‘shipping_for_package_’ . $package_key, false ); // Or true
    }
    }
    });
    }

    #37306
    Alex
    Keymaster

    Hello ionutionut95,

    Thanks for sharing this.

    Regards,
    Alex

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register