ResolvedLafka not compatible with “Local Delivery Drivers for Magazin”
- This topic has 6 replies, 2 voices, and was last updated 1 month, 2 weeks ago by
Alex.
- AuthorPosts
- April 14, 2023 at 9:37 pm #37260
ionutionut95
ParticipantHello
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
RoyApril 19, 2023 at 6:25 pm #37274Alex
KeymasterHello 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,
AlexApril 19, 2023 at 8:59 pm #37278ionutionut95
ParticipantThis solution is not working. The theme is still buggy with the plugin I paid.
April 20, 2023 at 12:02 pm #37281Alex
KeymasterHello ionutionut95,
Then probably this is not reason.
What exactly is the issue you have?
Regards,
AlexApril 20, 2023 at 3:02 pm #37288ionutionut95
ParticipantWhen 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.
April 22, 2023 at 2:03 am #37298ionutionut95
ParticipantThe 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 areaspublic 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
}
}
});
}April 24, 2023 at 12:16 pm #37306Alex
KeymasterHello ionutionut95,
Thanks for sharing this.
Regards,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.