Support » Plugin: Gravity PDF » Put “products” fields at top instead of bottom of pdf

  • Resolved reVwow

    (@revwow)


    Hello,

    is there a way to put all the products fields in pdf at the top, before all other fields ?
    As defaut it appear at the bottom, that is annoying…

    Thanks

    • This topic was modified 8 months ago by reVwow.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Hi,

    You can tap into our hooks, filters, and API to achieve this.

    These are the likely candidates you’ll need to use:

    1. https://gravitypdf.com/documentation/v5/api_product_table/ – for output the product table
    2. https://gravitypdf.com/documentation/v5/gfpdf_pre_html_fields/ – the hook to use to output the product table at the beginning of the document
    3. https://gravitypdf.com/documentation/v5/gfpdf_disable_product_table/ – hook to disable the product table at the bottom of the PDF

    Hope this helps!

    reVwow

    (@revwow)

    Thanks for answer am gonna look into it.

    have a good day

    reVwow

    (@revwow)

    I did it good, but one thing, what should i use to enable “product table” in the gfpdf_pre_html_fields ? Seems i did it wrong but i dont know why. Probably a stupid mistake but a little help would be appreciate.
    Thanks a lot.

    reVwow

    (@revwow)

    Ok found.

    Thanks for all previous tips.

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Great to hear you resolved your issue! If you’ve time, perhaps you could post your solution here so others can benefit, should they want to do the same.

    reVwow

    (@revwow)

    Sure you right.
    Ok first i use “Code Snippets” plugin to make it easy to add snippet.

    1st snippet : (Gravityform – disable product table)
    ***dont forget the id depends on your form id , mine is 1 here***

    add_filter( ‘gfpdf_disable_product_table’, function( $disable, $entry, $form, $config, $products ) {
    if ( $form[‘id’] === 1 ) {
    return true;
    }
    return $disable;
    }, 10, 5 );

    2nd snippet : (Gravityform – enable product table at top)

    add_action( ‘gfpdf_pre_html_fields’, function( $entry, $config ) {
    GPDFAPI::product_table( $entry );
    }, 10, 2 );

    As Jake said , very easy to make.

    have nice day, hope it may help.

    • This reply was modified 8 months ago by reVwow.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Put “products” fields at top instead of bottom of pdf’ is closed to new replies.