Banner Logo

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

Enhancement Request for Vendor Policies Endpoint

MultivendorX Pro

Resolved
Viewing 5 reply threads
  • Author
    Posts
    • #194266
      Justin Harrison
      Participant

      Since the policies tab on the Vendor profile page doesn’t use a template and is programmatically created in class-mvx-frontend.php under the function mvx_vendor_shop_page_policies_endpoint, I need a way to customize that. There are currently no filters available. If it was a template like the Policies tab that shows up under the individual product, I could override it and there would be no issues, but I can’t do that. I would like to request filters to be added to both the headings and each policy content. I need to be able to override the $_vendor_cancellation_policy value as we are mandating a sitewide policy for all vendors. The only way to do that currently would be some hook to manually set that policy in the database for every single vendor when they save something. That would be a pain and less reliable. Having filters to control what’s in the policy endpoint on the frontend would be a better solution.

      If you have a better solution on how to control/override the Shop policies endpoint on the Vendor profile page, please let me know and I’d be happy to try that.

    • #194291

      You can use the below hook to change the policy value of database manually for a particular vendor –

      
      mvx_vendor_shop_page_policies
      
      Copy
    • #194292
      Justin Harrison
      Participant

      This is an action hook, not a filter hook, and I wasn’t wanting to change it for a particular vendor. I wanted to change it for all vendors. Because this hook fires after the output, it technically won’t update the policies until after the policies are visited for the first time for each vnedor. It will also update the the policy for the vendor every time the policy is visited or I’ll have to do an additional select query to check to see if the policy matches the policy I’m wanting to update to. It’s not the worst thing in the world. Having a filter to override the policy title would be nice. You have a filter for that in the policy-tab.php template, but there’s no filter in the endpoint. I’ll figure out a way to update the policies and make it work, but there’s still no way to update the titles/headings like ‘Cancellation/Return/Exchange Policy’ without doing a gettext translation. Just not the ideal work situation, but I’ll deal with it.

    • #194295

      Hi,
      Extremely sorry for the inconvenience. Add the below code in the functions.php file of your current active theme an change as per your requirement.

      add_action('init', 'mvx_endpoint_custom');
      function mvx_endpoint_custom() {
          global $MVX;
          remove_action( 'mvx_vendor_shop_page_policies_endpoint', array($MVX->frontend, 'mvx_vendor_shop_page_policies_endpoint' ), 10, 2 );
          if (mvx_is_module_active('store-policy')) {
              add_action( 'mvx_vendor_shop_page_policies_endpoint', 'mvx_vendor_shop_page_policies_endpoint', 10, 2 );
          }
      }
      
      function mvx_vendor_shop_page_policies_endpoint( $store_id, $query_vars_name ){
          $_vendor_shipping_policy = get_user_meta( $store_id, '_vendor_shipping_policy', true ) ? get_user_meta( $store_id, '_vendor_shipping_policy', true ) : __( 'No policy found', 'multivendorx' );
      
          $_vendor_refund_policy = get_user_meta( $store_id, '_vendor_refund_policy', true ) ? get_user_meta( $store_id, '_vendor_refund_policy', true ) : __( 'No policy found', 'multivendorx' );
      
          $_vendor_cancellation_policy = get_user_meta( $store_id, '_vendor_cancellation_policy', true ) ? get_user_meta( $store_id, '_vendor_cancellation_policy', true ) : __( 'No policy found', 'multivendorx' );
      
          ?>
          <div class="mvx-policie-sec">
              <div class="mvx-policies-header mvx-tabcontent-header">
                  <div class='mvx-heading'><?php esc_html_e( 'Shop policies', 'multivendorx' ); ?></div>
              </div>
              <!-- Shipping policy -->
              <div>
                  <div class="mvx-sub-heading">
                      <span class="dashicons dashicons-cart"></span>
                      <p><?php esc_html_e( 'Shipping Policy', 'multivendorx' ); ?></p>
                  </div>
                  <div class='mvx-policie-sub-area'>
                      <p><?php echo wp_kses_post( $_vendor_shipping_policy ); ?></p>
                  </div>
              </div>
              <!-- Refund policy -->
              <div>
                  <div class="mvx-sub-heading">
                      <span class="dashicons dashicons-cart"></span>
                      <p><?php esc_html_e( 'Refund Policy', 'multivendorx' ); ?></p>
                  </div>
                  <div class='mvx-policie-sub-area'>
                      <p><?php echo wp_kses_post( $_vendor_refund_policy ); ?></p>
                  </div>
              </div>
              <!-- Cancellation policy -->
              <div>
                  <div class="mvx-sub-heading">
                      <span class="dashicons dashicons-cart"></span>
                      <p><?php esc_html_e( 'Cancellation/Return/Exchange Policy', 'multivendorx' ); ?></p>
                  </div>
                  <div class='mvx-policie-sub-area'>
                      <p><?php echo wp_kses_post( $_vendor_cancellation_policy ); ?></p>
                  </div>
              </div>
              <?php do_action( 'mvx_vendor_shop_page_policies', $store_id, $query_vars_name  ); ?>
          </div>
          <?php
      }
      Copy

      Regards,

    • #194318
      Justin Harrison
      Participant

      That worked perfectly. Thank you so much. I assumed there was some way to remove the endpoint and then add it back with my own, but I would have had to spend quite a bit of time figuring out the correct way to do it. I very much appreciate your assistance.

    • #194334

      @Justin Harrison We are happy to help you.
      It would be really great if you can give us 5/5 review here: https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post
      This would motivate the team further to do their job more efficiently.

Viewing 5 reply threads

The topic ‘Enhancement Request for Vendor Policies Endpoint’ is closed to new replies.