Foreach loop posting content twice

Končano Objavljeno pred 5 letoma/leti Plačilo ob prevzemu
Končano Plačilo ob prevzemu

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 projekta: #18357567

Več o projektu

4 predlogov Oddaljen projekt Aktiven pred 5 letoma/leti

Dodeljeno:

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 v 1 dnevu
(12 mnenj)
4.1

4 freelancerjev ponuja v povprečju za $31 na tem delu

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 v 1 dnevu
(213 ocen)
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 v 1 dnevu
(203 ocen)
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 v 0 dneh
(50 ocen)
6.0