Custom Field Data to Single Page Builder Product Meta

This topic has 10 replies, 3 voices, and was last updated 1 years, 5 months ago ago by Shehzad Ghazi

  • Avatar: Golden Eagle
    Shehzad Ghazi
    Participant
    May 27, 2023 at 18:55

    Hello, would you be kind enough to add some ACF tab to be included in Product meta, where Product SKU, and Tags are there, we have some custom data which is provided by our ERP that UPC and some more info,

    for example our ERP send out data for UPC and its mm_product_upc in product, we need this displayed at product meta above UPC.

    https://prnt.sc/dQW7HKBT85t7

    currently I see no option but to choose between those which are avaliable

    https://prnt.sc/Gfkfm378PF8b

    I see brand is provided but It was done by Woocommerce Brand Plugin, so if you can product additional data to be insert, it would make the job lot easier

    9 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 28, 2023 at 15:39

    Hello Shehzad Ghazi,

    Thank you for contacting us and for using XStore.

    Please note that additional customization in files is outside the scope of our basic support, but we will try to help you.

    1/ Could you please show us where your content should be displayed on the screenshot? Provide URL of single product from your site also.

    2/ We can offer you the following, please let us know if this is what you are looking for:
    – We will add a custom field that you can enable and move around as shown in the screenshot below: https://prnt.sc/-omzsCaUn59-
    You will need to add custom code to your child theme in order to modify the content that is displayed on your site.

    3/ If we understand you correctly, provide temporary wp-admin and FTP access.

    Kind Regards,
    8theme team

    Please contact administrator
    for this information.
    Avatar: Golden Eagle
    Shehzad Ghazi
    Participant
    May 28, 2023 at 17:37

    Thanks, I see the patch was made avaliable, and we applied it as well,

    we also know it has been asked few times that how to add custom data to product meta fields, so surely it will help those who wants to do it

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 29, 2023 at 12:37

    Hello Shehzad Ghazi,

    Thank you for your response.

    Unfortunately, without FTP access we cannot make the modification to the child theme for you. If you wish to do it yourself, you will need to use the following filter:
    product_meta_custom_content_filter
    If mm_product_upc is the meta field of the product (which we are not aware of and can only find out after getting FTP access), you will need to add the following code to the file wp-content\themes\xstore-child\functions.php:

    add_filter('product_meta_custom_content_filter', function (){
        $upc = get_post_meta( get_the_ID(), 'mm_product_upc', true );
        return 'UPC: ' . $upc;
    });

    We cannot guarantee the functionality of this code as we are unaware of whether mm_product_upc is a product meta field.

    Kind Regards,
    8theme team

    Avatar: Golden Eagle
    Shehzad Ghazi
    Participant
    May 29, 2023 at 17:55

    this mm upc field is custom field which is pushed by inventory software we use, and many others, so yes as you can see its working, and I did add as per your intructions to function.php, but sure with some alligment issues

    but one this, that it also show in variable field in which it should, only single item as it would have UPC, varaible item will also have UPC, but all different in atributes

    https://prnt.sc/WvdRo2__a72G Variable item example

    https://prnt.sc/7Yb8oXQIOf0R as you can see its working fine

    question: 1 I see recently that there was a patch for custom field in Element was just pushed as can be seen in your own provided screenshot

    https://prnt.sc/-omzsCaUn59-

    can we not use this to put some custom fields there? like we are doing now using function.php editing?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 30, 2023 at 12:17

    Hello Shehzad Ghazi,

    Thank you for your response.

    1/ Do you use the same UCP for all variations of the product, or does each variation have its own unique UCP? Could you please provide a link to the products where this functionality does not work?

    2/ Unfortunately, no. When using Single Product Builder, adding new content to the product description can only be done in this way (by combining the option and code in the functions.php).

    Kind Regards,
    8theme team

    Avatar: Golden Eagle
    Shehzad Ghazi
    Participant
    June 1, 2023 at 04:08

    https://prnt.sc/WvdRo2__a72G

    Variable item example, in which the UPC field shouldnt appear as Variable have different UPC values.

    https://prnt.sc/7Yb8oXQIOf0R

    as you can see its working fine, the code you provided and I entered in function.php is working fine

    now we just want to UPC to show in single product, and not in Variable Product.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 2, 2023 at 16:53

    Hello, Shehzad Ghazi,

    Thank you for your response.

    Please provide URL of the variable product from your screenshot.

    Kind Regards,
    8theme team

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    June 2, 2023 at 19:16

    Hello, Shehzad Ghazi
    In order to disable UPC on variable products, you need to replace the previous code with the next one.

    
    add_filter('product_meta_custom_content_filter', function (){
        $id = get_the_ID();
        $product = wc_get_product($id);
        $product_type = $product->get_type();
        if ( $product_type!= 'variable'){
            $upc = get_post_meta( $id, 'mm_product_upc', true );
            return 'UPC: ' . $upc;
        }
        return '';
    });
    

    Best Regards,
    8Theme’s Team

    Avatar: Golden Eagle
    Shehzad Ghazi
    Participant
    June 2, 2023 at 20:41

    Thanks, all worked fine now…! great help

  • Viewing 10 results - 1 through 10 (of 10 total)

The issue related to '‘Custom Field Data to Single Page Builder Product Meta’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.