Theme and Plugin Support
-
AuthorPosts
-
-
September 13, 2022 at 10:49 PM #141938l.ganParticipant
Hello
Thanks for your amazing support.
I ran into a problem when displaying the shipping method on the product page.
I have some code – it works but outputs “seller’s shipping” as just a value, no internal deliveries.
I mean, if there are 2 shipping methods in Seller’s Shipping:
For example Courier – 20 euros and air delivery 50 euros.
This code only outputs “Seller’s Shipping” – no attachments.Please tell me how to fix this code so that it works.
In the attachment of the photo, how the code displays the methods of delivery now.
I use the delivery method “Shipping by zones”<?php
// get all zones
$zones = WC_Shipping_Zones::get_zones();// get name of each zone and each shipping method for each zone
foreach ( $zones as $zone_id => $zone ) {echo ‘<tr><td>’;
echo ‘‘ . $zone[‘zone_name’] . ‘‘ . ‘</td><td>’;
$zone_shipping_methods = $zone[‘shipping_methods’];
foreach ( $zone_shipping_methods as $index => $method ) {
$instance = $method->instance_settings;// Initialize
$above = ”;
$output_cost = __( ‘Free’, ‘woocommerce’ );// Cost isset
if ( isset( $instance[‘cost’] ) ) {
// NOT empty
if ( ! empty ( $instance[‘cost’] ) ) {
// Output
$output_cost = wc_price( $instance[‘cost’] );
}
}// Min amount isset
if ( isset( $instance[‘min_amount’] ) ) {
// NOT empty
if ( ! empty ( $instance[‘min_amount’] ) ) {
// Above
$above = __( ‘от ‘, ‘woocommerce’ );// Output
$output_cost = wc_price( $instance[‘min_amount’] );
}
}echo $instance[‘title’] . ‘: ‘ . $above . ‘‘ . $output_cost . ‘‘ . ‘<br>’;
}echo ‘</td></tr>’;
}echo ‘</table></small></div>’;
?>
-
September 14, 2022 at 6:15 PM #141956MVX Support NinjaKeymaster
Hi,
kindly share the full code with the hook filter so we will check this on our end.Regards,
-
September 14, 2022 at 8:20 PM #141962l.ganParticipant
Yes, here
Please have a lookadd_action( ‘woocommerce_after_add_to_cart_form’, ‘action_woocommerce_after_add_to_cart_form’, 10, 0 );
function action_woocommerce_after_add_to_cart_form() {
// get all zones
$zones = WC_Shipping_Zones::get_zones();// get the shop base country
$base_country = WC()->countries->get_base_country();
$base_city = WC()->countries->get_base_city();// start display of table
echo ‘<div>’ . __( ‘shipping’, ‘woocommerce’ );
echo ‘<br><small><span class=”shipping-time-cutoff”>All orders are shipped from the ‘.$base_country.’. Order before 12AM Mon-Fri for same day delivery within ‘.$base_city.’. Order before 3PM Mon-Thu for next day delivery.</span></small>’;
echo ‘<small><table class=”shipping-and-delivery-table”>’;// get name of each zone and each shipping method for each zone
foreach ( $zones as $zone_id => $zone ) {echo ‘<tr><td>’;
echo ‘‘ . $zone[‘zone_name’] . ‘‘ . ‘</td><td>’;
$zone_shipping_methods = $zone[‘shipping_methods’];
foreach ( $zone_shipping_methods as $index => $method ) {
$instance = $method->instance_settings;// Initialize
$above = ”;
$output_cost = __( ‘Free’, ‘woocommerce’ );// Cost isset
if ( isset( $instance[‘cost’] ) ) {
// NOT empty
if ( ! empty ( $instance[‘cost’] ) ) {
// Output
$output_cost = wc_price( $instance[‘cost’] );
}
}// Min amount isset
if ( isset( $instance[‘min_amount’] ) ) {
// NOT empty
if ( ! empty ( $instance[‘min_amount’] ) ) {
// Above
$above = __( ‘от ‘, ‘woocommerce’ );// Output
$output_cost = wc_price( $instance[‘min_amount’] );
}
}echo $instance[‘title’] . ‘: ‘ . $above . ‘‘ . $output_cost . ‘‘ . ‘<br>’;
}echo ‘</td></tr>’;
}echo ‘</table></small></div>’;
} -
September 23, 2022 at 8:28 PM #141977l.ganParticipantThis reply has been marked as private.
-
-
September 15, 2022 at 7:09 PM #141981MVX Support NinjaKeymaster
HI,
To show the vendor shipping you have to add custom code. vendor shipping is not included in the WC_Shipping_Zones::get_zones(); function.Kindly checkout the below page how wcmp show the shipping zones.
https://github.com/multivendorx/dc-woocommerce-multi-vendor/blob/master/templates/vendor-dashboard/vendor-shipping.phpRegards,
-
-
AuthorPosts
The topic ‘Shipping by Zone – Seller’s shipping doesn’t display their shipping methods.’ is closed to new replies.