Foreach loop posting content twice

完了済み 投稿 5年前 着払い
完了済み 着払い

My plugin pulls values from custom meta data on an order and posts it to discord. I made a change to the script and now it's double posting the custom meta data.

The full file of the script is uploaded as well as an example file that contains just the loop. The loop can be found in the full file as well.

On line 22 I changed

add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'send_order' ), 15 );

To

add_action( 'woocommerce_order_status_processing', array( $this, 'send_order' ), 15 );

Once I change to the status woocommerce_order_status_processing my forloop starts double posting everything. I need the double posting to stop.

Example of how the discord post looks

Bob Joe <-- clients name

Order #123123 <-- order number

Brand New Tee Shirt <-- Product Name

Color: Red <-- What should post

Size: Medium

Color: Red <-- Double post

Size Medium

Only custom options double up and only with that one filter set. I need that filter set though or at least one that triggers when a post is set to processing.

Solution should only trigger when set to processing.

PHP Wordpress

プロジェクトID: #18357567

プロジェクトについて

4個の提案 リモートプロジェクト アクティブ 5年前

アワード:

maya261

I am here to help you with the foreach loop. Send me a message to discuss it. I am ready to start work right now

$30 USD 1日以内
(12レビュー)
4.1

4人のフリーランサーが、平均$31 で、この仕事に入札しています。

alyaspk

Hi, I am ready to fix your loop issue and assure 100% satisfaction guarantee. Please have a look on my profile to see my past work and reviews. Looking forward to your kind response. Regards Muhammad Alyas

$29 USD 1日以内
(213件のレビュー)
7.5
adityasharma91

Hello there, I am expert in PHP/wordpress. I can resolve that issue right now. so please share live details then let's fix asap. Thanks

$15 USD 1日以内
(203件のレビュー)
6.5
profydev

Hi i can fix foreach loop issue, i will fix this within 10 minutes, send message for start work right now. thank you.

$50 USD 0日以内
(50件のレビュー)
6.0