Foreach loop posting content twice

Completato Pubblicato 5 anni fa Pagato alla consegna
Completato Pagato alla consegna

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

Rif. progetto: #18357567

Info sul progetto

4 proposte Progetto a distanza Attivo 5 anni fa

Assegnato a:

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 in 1 giorno
(12 valutazioni)
4.1

4 freelance hanno fatto un'offerta media di $31 per questo lavoro

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 in 1 giorno
(213 valutazioni)
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 in 1 giorno
(203 valutazioni)
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 in 0 giorni
(50 valutazioni)
6.0