Advertisement
palsushobhan

wcfm-show-sold-by-on-store-page

Jun 28th, 2023
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. add_action('woocommerce_after_shop_loop_item_title', function () {
  2.     global $WCFMmp, $product;
  3.     if ( ! wcfm_is_store_page() ||
  4.         ! $WCFMmp->wcfmmp_vendor->is_vendor_sold_by() ||
  5.         ! apply_filters( 'wcfmmp_is_allow_archive_product_sold_by', true ) ||
  6.         ! $product ||
  7.         ! method_exists( $product, 'get_id' )
  8.     ) return;
  9.    
  10.     $wcfm_store_url = wcfm_get_option( 'wcfm_store_url', 'store' );
  11.     $store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
  12.     if ( ! empty( $store_name ) ) {
  13.         $store_user = get_user_by( 'slug', $store_name );
  14.         $store_id = $store_user->ID;
  15.         $product_id = $product->get_id();
  16.         if( apply_filters( 'wcfmmp_is_allow_archive_sold_by_advanced', false ) ) {
  17.             $WCFMmp->template->get_template( 'sold-by/wcfmmp-view-sold-by-advanced.php', array( 'product_id' => $product_id, 'vendor_id' => $store_id ) );
  18.         } else {
  19.             $WCFMmp->template->get_template( 'sold-by/wcfmmp-view-sold-by-simple.php', array( 'product_id' => $product_id, 'vendor_id' => $store_id ) );
  20.         }
  21.     }
  22. }, 50 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement