Where is the documentation for cart_details->meta field

This topic contains 6 replies, has 3 voices, and was last updated by  picocodes 4 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #4159

    Arshad Ali
    Full Member
    Post count: 27

    I am really interested in using this meta field and how it can be used. However, I dont find any documentation, detailing on what all parameters I can use on “meta” field. Please enlighten me on this.

    #4161

    Alex Rollin
    Moderator
    Post count: 27815

    Some information can be found here:
    https://wpinvoicing.com/support/topic/what-is-the-use-of-item-meta-on-cart_details/#post-4083

    If you have more questions let us know.

    #4162

    Arshad Ali
    Full Member
    Post count: 27

    Haha, that was me who started that thread and discussion was inconclusive from my perspective.

    However, I am looking for “documentation”.

    #4164

    Alex Rollin
    Moderator
    Post count: 27815

    Can you describe what you are trying to do?

    We don’t do customizations here in the forum, but, if we can help you find the filter or hook for your goal, we can advise about that.

    #4168

    Arshad Ali
    Full Member
    Post count: 27

    Hey Alex,

    From customisation perspective, I have two goals.

    1. I want to add some additional description to the cart item at the time of adding it to invoice through programming interface. This description will be specific to the invoice. Description in item except is shown on all invoices.

    2. I am creating invoice against my bookings ( my custom post type). I want to add the booking reference to the invoice. May be close to invoice number.

    I am using public notes right now. But these notes are visible only in the email body. They are not shown on pdf/web version of invoice.

    Thank you.

    Warm regards,
    Arshad

    #4170

    picocodes
    Moderator
    Post count: 141

    Hi Ali,

    Currently, there is no way of adding a custom description for each item in the invoice. Here is an array of allowed arguments.

    
    array(
       'quantity'      => 1,
       'id'            => false, // Required
       'name'          => '', // Defaults to the item's name but can be used to specify a different name
       'custom_price'  => '',
       'discount'      => 0,
       'tax'           => 0.00,
       'meta'          => array(),
       'fees'          => array()
    );
    

    The only way to accomplish what you are trying is by specifying your custom description in the item’s meta. You can then hook into the

    wpinv_print_invoice_line_item_summary

    and replace the item’s excerpt with your custom description.

    See the following line to learn more about the hook:- https://github.com/AyeCode/invoicing/blob/039be99f715f751bbd253dbf0e77dc4cc8a5e2de/includes/wpinv-template-functions.php#L1059

    #4171

    picocodes
    Moderator
    Post count: 141

    You can store your booking’s reference in an invoice’s custom field then display it via one of the many hooks fired when displaying an invoice. Here are a few:-

    
    wpinv_before_invoice_content
    wpinv_invoice_print_body_start
    wpinv_invoice_display_right_actions
    wpinv_invoice_display_left_actions
    wpinv_invoice_top_bar_left
    wpinv_invoice_top_bar_right
    wpinv_before_display_totals_table
    
Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket