• Resolved mawaybe

    (@mawaybe)


    Hi:

    We need to export the coupon id and code to a POS system. It appears to work ‘sometimes’ using the following fields in WP All Export.

    {_fcpdf_order_item_1536_coupon_id}
    {_fcpdf_order_item_1536_coupon_code}

    So on one order we get this output:

    <_fcpdf_order_item_1536_coupon_id>1050006</_fcpdf_order_item_1536_coupon_id>
    <_fcpdf_order_item_1536_coupon_code>uwdu7</_fcpdf_order_item_1536_coupon_code>

    But on the next order we get this output:

    <_fcpdf_order_item_1536_coupon_id/>
    <_fcpdf_order_item_1536_coupon_code/>

    … just blank/empty records.

    If we can get this working consistently we’ll upgrade to your Pro package.

    Do you have any ideas what we are doing wrong? Could it be that one order has one coupon/gift card and the second has multiple?

    Thanks for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support rzepsen

    (@rzepsen)

    Hello Mawaybe

    Thank you for your message

    If the fields are empty it is likely that no voucher has been generated.

    Please check whether the coupon/voucher has been generated in the cases you are reporting.

    If the problem relates to an issued coupon, please let me know.

    Best regards

    Plugin Support rzepsen

    (@rzepsen)

    Hello @mawaybe

    As we haven’t got any replies, I’m marking this topic as resolved for now.

    Best regards

    Thread Starter mawaybe

    (@mawaybe)

    Hi

    Apologies for my delayed response.

    I think the issue is when using WP All Export, I am inserting lines like

    {_fcpdf_order_item_1536_coupon_id}
    {_fcpdf_order_item_1536_coupon_code}

    But when I use an alternate export tool, I can see lots of ‘id’ and ‘code’ values:

    <Meta-_fcpdf_order_item_1536_coupon_code></Meta-_fcpdf_order_item_1536_coupon_code>
      <Meta-_fcpdf_order_item_1536_coupon_id></Meta-_fcpdf_order_item_1536_coupon_id>
      <Meta-_fcpdf_order_item_1549_coupon_code>qd10p</Meta-_fcpdf_order_item_1549_coupon_code>
      <Meta-_fcpdf_order_item_1549_coupon_id>1050042</Meta-_fcpdf_order_item_1549_coupon_id>
      <Meta-_fcpdf_order_item_1572_coupon_code></Meta-_fcpdf_order_item_1572_coupon_code>
      <Meta-_fcpdf_order_item_1572_coupon_id></Meta-_fcpdf_order_item_1572_coupon_id>
      <Meta-_fcpdf_order_item_1578_coupon_code></Meta-_fcpdf_order_item_1578_coupon_code>
      <Meta-_fcpdf_order_item_1578_coupon_id></Meta-_fcpdf_order_item_1578_coupon_id>
      <Meta-_fcpdf_order_item_1579_coupon_code></Meta-_fcpdf_order_item_1579_coupon_code>
      <Meta-_fcpdf_order_item_1579_coupon_id></Meta-_fcpdf_order_item_1579_coupon_id>

    Is the plugin generating a unique meta field for every coupon? Is that why I cannot include it in an XML export template – the ‘item_1578’ in the ‘_fcpdf_order_item_1578_coupon_id’ keeps changing for every coupon so it cannot be templated?

    Thanks for your help.

    Plugin Support rzepsen

    (@rzepsen)

    Hello, @mawaybe
    Thank you for your message.
    Please take a look if the solution I am sending will be sufficient.

    $coupon_ids = [];
    $order_id = 100; // my order ID
    $order = wc_get_order( $order_id );
    if ( $order && ! empty( $order->get_items() ) ) {
       foreach ( $order->get_items() as $item ) {
          $coupon_id = get_post_meta( $order->get_id(), '_fcpdf_order_item_' . $item->get_id() . '_coupon_id', true );
          $coupon_ids[] = $coupon_id;
       }
    }
    
    var_dump( $coupon_ids );

    Best regards

    Thread Starter mawaybe

    (@mawaybe)

    Thank you very much – I will try this within the next 24 hours. Best.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Cannot export Coupon ID or Code’ is closed to new replies.