Redirect to store page after add to cart

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Feature Request Redirect to store page after add to cart

Viewing 4 reply threads
  • Author
    Posts
    • #121227
      pebi44
      Participant

      Hi, I’m Esteban and I’m starting to use wcfm.
      I am limiting the sale of products to one Vendor.
      After adding a product to the cart, I need to redirect it to the corresponding vendor store page.
      Thank.
      Sorry for my English.

    • #121330
      pebi44
      Participant

      I am limiting the sale of products to one Vendor per Order

    • #121537
      Craig
      Participant

      pebi44 how do you do that limiting of one vendor per order?

    • #121661
      Sushobhan
      Keymaster

      Hi,
      Thanks for getting in touch.

      First, go to WooCommerce > Settings > Products > General and disable both options: “Redirect to the cart page after successful addition” & “Enable AJAX add to cart buttons on archives“. Refer to this – https://imgur.com/3izmr6d

      After that, add the following snippet to your child theme’s functions.php. In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      function after_add_to_cart_redirect_to_vendor_store( $url, $adding_to_cart ) {
          $product = wc_get_product( $adding_to_cart );
          if ( $product ) {
              $vendor_id = wcfm_get_vendor_id_by_post($product->get_id());
              if(wcfm_is_vendor($vendor_id)) return wcfmmp_get_store_url($vendor_id);
              return get_permalink( wc_get_page_id( 'shop' ) );
          }
          return $url;
      }
      
      add_filter( 'woocommerce_add_to_cart_redirect', 'after_add_to_cart_redirect_to_vendor_store', 10, 2 );

      Let me know how it goes.
      Thanks!

      • #121790
        pebi44
        Participant

        Thanks, it worked perfect!

    • #121833
      Sushobhan
      Keymaster

      You are always welcome 🙂

      Let me know if there’s anything else we can help you with.

      Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.