Banner Logo

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

Add a 2nd product description field

WCMp Core

Resolved
Viewing 17 reply threads
  • Author
    Posts
    • #124484
      MaxenceTP
      Participant

      Hello,
      I have two product descriptions: one in French and one in English. In Woocommerce I can modify both descriptions thanks to the “Advanced Custom Fields” plugin which allows me to add another text field like this: https://prnt.sc/19gugmz

      All this works perfectly, the problem is that the seller from his panel can’t modify the 2nd description I added.
      How can I copy the “Product description” field to put a second similar one but save the text in the “description_fr” meta?
      Here is an example (I just modified the html in my browser): https://prnt.sc/19gwlyx

      Thank you very much for your help, I know it requires some modifications but otherwise it prevents me from using the product creation feature of your plugin correctly.

    • #124575

      @MaxenceTP, it will be really helpful for us if you can share a video to explain the issue.
      Also, do you think if the vendor can access the field of ACF it will solve the issue?

    • #124581
      MaxenceTP
      Participant

      Hey!

      “do you think if the vendor can access the field of ACF it will solve the issue?”
      -> I think, yes 🙂

      The video is in the next private post to be sure you understand correctly.

    • #124582
      MaxenceTP
      Participant
      This reply has been marked as private.
    • #124603
      This reply has been marked as private.
    • #124619
      MaxenceTP
      Participant

      I’m not using any multilingual plugin. That’s only custom code to add this 2nd description.
      I saw this addon, but that’s a little bit expensive just for adding a 2nd text editor which save the content into the “description_fr” variable :/

    • #124669

      hi

      can you explain the flow of your custom code !!

    • #124673
      MaxenceTP
      Participant

      The custom code is only to show this 2nd description on the Woocommerce product page.
      On the admin side, I use “Advanced Custom Fields” to add a textbox to edit the following post_meta : “description_fr”

    • #124691

      @MaxenceTP, the only solution would be to add a custom field in the vendor’s add product page and display the same. For help, you can check this : https://multivendorx.com/tech-blog/add-new-tab-in-add-product-page/

    • #124699
      MaxenceTP
      Participant

      Yes I see, but is it possible to add a fiel like that https://prnt.sc/19gwlyx instead ?

    • #124770
    • #124800
      MaxenceTP
      Participant

      Okay so I was able to create the 2nd description editor by overwriting the edit-product.php. The content is correctly loaded, but I don’t know how to save the result of the wp_editor into the meta “description_fr”.

      Here is the code I added :

      <div class="form-group product-description">
          <label class="control-label col-md-12" for="product_description_fr"><?php esc_attr_e( 'Product description - FR', 'dc-woocommerce-multi-vendor' ); ?></label>
          <div class="col-md-12">
              <?php
              $settings = array(
                  'textarea_name' => 'product_description_fr',
                  'textarea_rows' => get_option('default_post_edit_rows', 10),
                  'quicktags'     => array( 'buttons' => 'em,strong,link' ),
                  'tinymce'       => array(
                      'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
                      'theme_advanced_buttons2' => '',
                  ),
                  'editor_css'    => '<style>#wp-product_description_fr-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
              );
              if( !apply_filters( 'wcmp_vendor_product_description_richedit', true ) ) {
                  $settings['tinymce'] = $settings['quicktags'] = $settings['media_buttons'] = false;
              }
              wp_editor( get_post_meta($product_object->id,'description_fr',true), 'product_description_fr', $settings );
              ?>
          </div>
      </div>
      Copy
    • #124836

      Hi,
      Using below hook you can save the data.

      do_action( 'wcmp_process_product_object', $product, $_POST );
      Copy

      Regards,

    • #124863
      MaxenceTP
      Participant

      Can you help me a bit more on the code I have to use?
      The goal is to update the “description_fr” meta of the post

    • #124902

      Hi,

      Please add this code in the function.php of the current active theme and check:

      function save_custom_product_data( $product, $post_data ) { 
         if( isset($post_data['post_ID']) && isset($post_data['product_description_fr'])) {
              update_post_meta( absint( $post_data['post_ID'] ), 'description_fr', $post_data['product_description_fr']);     
          }   
      }  
      add_action( 'wcmp_process_product_object', 'save_custom_product_data', 10, 2 );
      Copy

      Regards,

    • #124921
      MaxenceTP
      Participant

      Thanks !
      It’s working :p

    • #124931

      We are happy to help @MaxenceTP

    • #127774

      we are happy to help you
      We would love it if you shared your experience by giving us 5/5 review here :
      https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post
      Seeing glowing reviews from existing customers makes others more comfortable knowing they’ll get the support they need with an issue with our services when arise.

Viewing 17 reply threads

The topic ‘Add a 2nd product description field’ is closed to new replies.