Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

display delivery methods on the product page automatically

WCMp Core

Resolved
Viewing 4 reply threads
  • Author
    Posts
    • #126978
      l.gan
      Participant

      Hey
      https://www.businessbloomer.com/woocommerce-show-shipping-rates-single-product-page/ showed how you can automatically display shipping methods on the product page with one of the third-party marketplace plugins. Tell me how you can do this with your plugin? It was just a great feature.

    • #127019

      @l.gan, thanks for the link.

      I presume this plugin is using woocommerce filter, hence that should work perfectly. If the flow is to display shipping rate at the single product page, then it should work prefectly.

      • #127027
        l.gan
        Participant

        It doesn’t work.

        The first code does not show anything for some reason (I cannot understand why and I ask for your help), and the second is written for your competitor plugin. Can you test this code yourself? Maybe they only work together? Or do you need to write your “values” in the code?

        How much did I know that if this code works with a plugin of your competitor, then maybe if you correct the necessary values for your plugin there, it will work for WCMP as well?
        i tried this, but i don’t see anything under the add to cart button:

        function bbloomer_wcmp_vendor_shipping() {
        $zones = WC_Shipping_Zones::get_zones();
        echo ‘<div><i class=”fas fa-truck”></i> ‘ . __( ‘Shipping’, ‘woocommerce’ );
        echo ‘<table>’;
        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;
        $cost = $instance[‘cost’] ? $instance[‘cost’] : $instance[‘min_amount’];
        echo $instance[‘title’] . ‘ ‘ . wc_price( $cost ) . ‘<br>’;
        }
        echo ‘</td></tr>’;
        }
        echo ‘</table></div>’;
        }

        add_action( ‘woocommerce_after_add_to_cart_form’, ‘bbloomer_wcmp_vendor_shipping’ );

        function bbloomer_wcmp_vendor_shipping() {
        global $product;
        $product_id = $product->get_id();
        $vendor = get_wcmp_vendor( $product, ‘product’ );
        if ( $vendor->zone_data ) {
        echo ‘<div><i class=”fas fa-truck”></i> ‘ . __( ‘Shipping’, ‘woocommerce’ );
        echo ‘<table>’;
        foreach ( $vendor->zone_data as $key => $zone ) {
        echo ‘<tr><td><i>’;
        echo $zone[‘zone_name’] . ‘</i></td><td>’;
        $zone_shipping_methods = $zone[‘zone_shipping_methods’];
        foreach ( $zone_shipping_methods as $index => $method ) {
        $cost = $method[‘method_cost’] ? $method[‘method_cost’] : $method[‘min_amount’];
        echo $method[‘method_title’] . ‘ ‘ . wc_price( $cost ) . ‘<br>’;
        }
        echo ‘</td></tr>’;
        }
        echo ‘</table></div>’;
        }
        }

        I am 100% sure that this will be useful to a large number of your users.

    • #127099

      @l.gan, our developer will look into this. But it might take few days, as this requires coding and testings.

    • #127150

      Hi,
      This code will not work. Because this code is compatible with YITH WooCommerce Multi Vendor plugin. All functions and methods are for that plugin. You have created a function for our plugin to do this. In our case we have provided 3 different shipping. So firstly you have to check which is enabled for that particular vendor ( REF : get_user_meta($vendor_id, ‘vendor_shipping_options’, true) ) then you have do rest of the work for that particular vendor.
      If it country wise then — wcmp_get_user_meta( $vendor_id, ‘_wcmp_shipping_by_country’, array() )
      If it distance wise then — get_user_meta( $vendor_id, ‘_wcmp_shipping_by_distance’, true )
      If it zone wise then — wcmp_get_shipping_zone() ( you might customize this funtion/ create a new )
      Thanks

      • #127156
        l.gan
        Participant

        Hi, unfortunately I didn’t understand anything …

    • #127219

      Hi, Since this is a custom code written for third-party plugin hence we have to do the full coding and testing on our end. Now currently we don’t have such bandwidth to work on this. That is why Raju has shared the hooks. So that If you need this urgently you can develop it on your own.

      But whenever we can assign someone on this, we will create a blog too. Once we will publish such blog, we will let you know.
      We wil keep you posted.

Viewing 4 reply threads

The topic ‘display delivery methods on the product page automatically’ is closed to new replies.