New update – shipping problem
-
I’m facing an issue after updating to 5.0 that prevents me from creating new pages or editing any of my current ones.
“Uncaught Error: Call to a member function needs_shipping() on null
in [Root]/modules/StoreShipping/Frontend.php on line 170“.Also, what are the specific meta keys used to store the vendor’s address? I am wondering if these have changed – I had custom tax rules and a snippet to show the address of the vendor in the local pickup shipping option but neither seem to work anymore.
-
Hi @a340300 , Thank you for reaching out and sharing the details of the issue.
Regarding the store address, in MultiVendorX 5.0 we have refactored and partially recoded the product and related modules as part of the overall architectural upgrade. This is likely why you are encountering this issue. I have already informed our development team so they can review this more closely.
Since you’re also facing issues with page creation and editing, it would really help us if you could share either:
- A short screen recording showing how the issue occurs, or
- Any console error logs from your browser
This will help us better understand the exact scenario and assist you more efficiently.
As for the store (vendor) address meta keys, they are still being saved, but the structure has been streamlined. Currently, the address-related data is stored in the store meta table using the following keys:
- address
- city
- zip
- country
- state
You can retrieve and render these values directly from the store meta as needed.
Please share the additional details when convenient, and we’ll make sure to assist you further.
This is the error I get on every page when trying to edit them (it was working up until the update):
Uncaught Error: Call to a member function needs_shipping() on null
in [REDACTED]/plugins/dc-woocommerce-multi-vendor/modules/StoreShipping/Frontend.php on line 170Call stack:
MultiVendorX\StoreShipping\Frontend::multivendorx_checkout_user_location_fields()
wp-includes/class-wp-hook.php:341WP_Hook::apply_filters()
wp-includes/plugin.php:205apply_filters()
wp-content/plugins/woocommerce/includes/class-wc-checkout.php:298WC_Checkout::initialize_checkout_fields()
wp-content/plugins/woocommerce/includes/class-wc-checkout.php:322WC_Checkout::get_checkout_fields()
wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php:512WC_Stripe_UPE_Payment_Gateway::javascript_params()
wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-stripe-blocks-support.php:242WC_Stripe_Blocks_Support::get_gateway_javascript_params()
wp-content/plugins/woocommerce-gateway-stripe/includes/class-wc-stripe-blocks-support.php:190WC_Stripe_Blocks_Support::get_payment_method_data()
wp-content/plugins/woocommerce/src/Blocks/Payments/PaymentMethodRegistry.php:62Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry::get_all_registered_script_data()
wp-content/plugins/woocommerce/src/Blocks/Payments/Api.php:92Automattic\WooCommerce\Blocks\Payments\Api::add_payment_method_script_data()
wp-includes/class-wp-hook.php:341WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:365WP_Hook::do_action()
wp-includes/plugin.php:522do_action()
wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:287Automattic\WooCommerce\Blocks\BlockTypes\MiniCart::enqueue_data()
wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php:111Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock::enqueue_editor_assets()
wp-includes/class-wp-hook.php:341WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:365WP_Hook::do_action()
wp-includes/plugin.php:522do_action()
wp-admin/edit-form-blocks.php:339require('[REDACTED]/wp-admin/edit-form-blocks.php')
wp-admin/post.php:187
I am also wondering if you can suggest a code snippet to force taxes to be calculated based on the vendor’s address when the customer has selected local pickup. I had a snippet that worked before the update but it does not anymore.
Thank you!
Hello @a340300, I have shared the error with the team.
Regarding the code snippet, can you share the earlier code snippet you had used, so we can see what kind of modification it might require.
Thank you!
I checked my database from my backup pre-update and this is what I had used to calculate taxes based on the vendor’s store location for local pickup orders rather than the customer’s shipping address:
/**
* FORCE TAX BY VENDOR LOCATION FOR LOCAL PICKUP
*/
// 1. Tell WooCommerce NOT to automatically use the main shop base for local pickup
add_filter( 'woocommerce_apply_base_tax_for_local_pickup', '__return_false' );
// 2. Inject the Vendor's billing address into the tax calculation
add_filter( 'woocommerce_customer_taxable_address', 'mvx_local_pickup_vendor_tax_location', 10, 1 );
function mvx_local_pickup_vendor_tax_location( $address ) {
// Only run on frontend checkout/cart updates
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return $address;
if ( ! WC()->session ) return $address;
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$is_local_pickup = false;
// Check if the user selected a local pickup method
if ( ! empty( $chosen_methods ) ) {
foreach ( $chosen_methods as $method ) {
if ( strpos( $method, 'local_pickup' ) !== false ) {
$is_local_pickup = true;
break;
}
}
}
if ( $is_local_pickup && WC()->cart ) {
$cart = WC()->cart->get_cart();
foreach ( $cart as $item ) {
// Get the vendor for the current product
$vendor = get_mvx_product_vendors( $item['product_id'] );
if ( $vendor && isset( $vendor->id ) ) {
$vendor_id = $vendor->id;
// Pull address from the billing meta keys you identified
$country = get_user_meta( $vendor_id, 'billing_country', true );
$state = get_user_meta( $vendor_id, 'billing_state', true );
$postcode = get_user_meta( $vendor_id, 'billing_postcode', true );
$city = get_user_meta( $vendor_id, 'billing_city', true );
// If the vendor has a valid country and state set, use it
if ( ! empty( $country ) && ! empty( $state ) ) {
return array( $country, $state, $postcode, $city );
}
}
}
}
return $address;
}Hi @a340300,
Thanks for sharing the code. We can see you’re using WooCommerce hooks/filters to fetch the vendor’s address.
You can apply the same logic here. Each product stores the store ID in its meta key
multivendorx_store_id. Using this ID, you can fetch the corresponding store details. The address information you’re looking for is saved in the store meta, so once you have the store ID, you can retrieve all address-related data from there.In short:
Product → getmultivendorx_store_id→ use it to fetch store meta → retrieve address fields.Also, we’ll be releasing an update tomorrow that includes a fix for the shipping error.
Best regards,
MoumitaHi @a340300,
We’ve released an update today. Please make sure to update to the latest version, as it includes the fix for the shipping issue.
Thank you very much. I was able to fix the tax issue and the update cleared up the shipping problem!
I did have another question: I’d like to add a page where people can search for vendors based on location. It seems this was a shortcode before (https://multivendorx.com/docs/faqs/how-can-customer-search-vendor-by-location/) but it does not seem to work with the new update. Is there a new shortcode I can use to achieve this?
Hi @a340300 ,
Glad to hear the tax and shipping issues are now resolved 🙂
Regarding your query about searching vendors by location — in the latest version, the updated shortcode to display the store list is:
[marketplace_stores]To enable location-based filtering/search, please make sure that Geo Location is properly configured from:
Settings → Store Configuration → Geo LocationOnce this is set up, the store listing will support location-based functionality.
Let us know if you need any help configuring this further
Got it, thank you.
Another thing I wanted to mention was that in Settings -> Store Configuration -> Appearance, no matter which option I choose, the store page always has the logo, store name, and description overlayed on top of the banner (like the Luxe display). I wanted to enable the Dynamic option (store info below the banner), but it always appears as the Luxe configuration. I also tried Signature View but they all look like Luxe.
<span style=”font-size: inherit;”>Hi</span> @a340300, <span style=”font-size: inherit;”>Apologies for the delayed response.</span>
We have released an update that includes the fix for this issue. Please ensure that you are using <strong data-start=”140″ data-end=”170″>MultiVendorX version 5.0.2 or later.
Kindly update and let us know if the issue persists.
Thank you for letting me know about the update. I tested my site and it appears that the format still has the store name and logo over the banner instead of below (i.e. no matter what format I choose, it defaults to the style of Luxe Display).
A few additional issues/questions
- When a store adds a product and enables stock management, the product says out of stock even with an SKU and quantity entered.
- I find that my site runs very slowly now. It takes upwards of 10 seconds to see a store’s page, and the vendor dashboard takes several clicks and several seconds to load a page, add a product, etc.
- When using the shortcode [marketplace_stores order=”ASC”], the products are displayed and the product title text is very large. Is it possible to just display the store logos and names, rather than showing the products as well? This is just for a page to search vendors, customers can still purchase from the store’s page.
Hello @a340300,
Thank you for your detailed feedback. Please find our responses below:
1. Store layout (banner, name, and logo position)
=> It may be due to the theme you are using being block-based. In such cases, the layout is controlled via the block editor.
You can edit the Shop page using the block editor and select the appropriate template from there.
Here’s a reference: https://www.awesomescreenshot.com/video/52089366?key=f2d55ab07a1fa52558a830734aee98d82. Product showing out of stock despite quantity entered
=> This issue is occurring because the quantity field is not getting saved properly.
We have already created a GitHub issue for this, and it will be fixed in an upcoming update.
You can track the progress here: https://github.com/multivendorx/multivendorx/issues/17633. Site performance (slow loading dashboard and store pages)
=> This behavior is unexpected, as similar performance issues were addressed in recent updates.
Since you are still experiencing this, we recommend reaching out to us directly here ,so our developers can investigate this further on your setup.4. Shortcode display issue ([marketplace_stores])
We have tested the shortcode and did not encounter this issue, both with the shortcode and block editor usage.
You can refer to this example: https://www.awesomescreenshot.com/video/52089296?key=226f1e925385adb8be8807019b2998d3As this seems specific to your setup, we request you to contact us directly here, so our developers can take a closer look.
Please feel free to reach out, and we’ll be happy to assist you further.
Thank you, I was able to fix issues 1 & 4!
For issue 3: On every page load — including single product pages — the function MultiVendorX\Block->enqueue_all_block_assets() is being called 40 times instead of once. Each call triggers a full chain of database queries including:
- MultiVendorX\Store\Store::get_store() — 40 to 41 calls
- MultiVendorX\Store\Store->get_all_meta() — 40 to 41 calls (including repeated calls for store_id = 0)
- WC_Shipping_Zone_Data_Store->get_zones() — 40 to 41 calls
- WC_Shipping_Zone_Data_Store->get_zone_data_for_ids() — 80 to 82 calls
- WC_Shipping_Zone_Data_Store->get_zone_locations_for_ids() — 80 to 82 calls
- WC_Shipping_Zone_Data_Store->get_methods() — 80 to 82 calls
This results in 450+ duplicate queries on all pages, causing 20-second load times and frequent 502 bad gateway errors. Query Monitor shows all of these trace back to enqueue_all_block_assets() being called in a loop — apparently once per registered block rather than once per page. This occurs on all pages from those with vendor content (like vendor storefronts, product pages) to simple pages without any vendor data like ‘about us’ and the privacy policy
You must be logged in to reply to this topic.