• Resolved ascanatian

    (@ascaron4o)


    Hi,

    When I try to add following in custom invoice.php template:

    <?php echo do_shortcode('[shortcode data_id="' . $this->order_number() . '"]'); ?>

    It gives me 200: parseerror when I try to check on the template

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Hi @ascaron4o,

    What are you trying to do?

    Thread Starter ascanatian

    (@ascaron4o)

    Hi, I’m trying to add shortcode from another plugin to the invoice template in order to show the information I want on the invoice.

    Plugin Contributor dwpriv

    (@dwpriv)

    What error do you get in your logs as outlined here? You’re looking for logs prefixed with wpo_wcpdf or fatal_errors

    • This reply was modified 10 months, 1 week ago by dwpriv. Reason: fixed incorrect link
    Thread Starter ascanatian

    (@ascaron4o)

    in wpo_wcpdf – Fatal error: Call to a member function get_items() on bool ..(/home/..leading to plugin file dir)

    Problem is if I hardcoded it like so:

    <?php echo do_shortcode('[shortcode order_id="23123"]'); ?>

    its working, but if I try to put it dynamically like so:

    <?php echo do_shortcode('[shortcode order_id="' . $this->order_number() . '"]'); ?>

    It’s not working.

    So what is the right way to put the order number dynamically in the invoice.php?

    • This reply was modified 10 months, 1 week ago by ascanatian.
    • This reply was modified 10 months, 1 week ago by ascanatian.
    • This reply was modified 10 months, 1 week ago by ascanatian.
    • This reply was modified 10 months, 1 week ago by ascanatian.
    Plugin Contributor dwpriv

    (@dwpriv)

    Are you adding this in a custom template? If so, you can try this:

    $this->order->get_order_number();

    If not, how are you adding the snippet and where are you trying to print the information on the invoice?

    Thread Starter ascanatian

    (@ascaron4o)

    Perfect, now it works!

    <?php echo do_shortcode('[shortcode order_id="' . $this->order->get_order_number() . '"]'); ?>

    And yes, I’m adding in custom invoice.php template -> woocommerce/pdf/theme/invoice.php

    Thanks a lot!

    Plugin Contributor dwpriv

    (@dwpriv)

    No problem and thanks for your confirmation. I will mark this topic as resolved πŸ™‚

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘200 parse error’ is closed to new replies.