• Usando o plugin WooCommerce Subscriptions, Versão 6.5.0 o plugin (na última versão) não envia os dados na chamada do webhook, seria interessante que o plugin prestasse esse suporte, pois os dados enviados pelo webhook ficam inconsistentes. Criei uma solução usando o action woocommerce_rest_prepare_shop_subscription_object

    add_action( 'woocommerce_rest_prepare_shop_subscription_object', 'cdh_wsec_add_custom_attributes_to_subscription_rest_api', 10, 3 );
    function cdh_wsec_add_custom_attributes_to_subscription_rest_api( $response, $post, $request ) {

            $subscription_id = $post->get_id();

            //edit subscription shipping response

            $shipping_phone = $post->get_meta('_shipping_phone1', true);

            if(!$shipping_phone){

                $shipping_phone = $post->get_meta('_shipping_phone', true);

            }

            $shipping_cellphone = $post->get_meta('_shipping_cellphone', true);

            $shipping_neighborhood = $post->get_meta('_shipping_neighborhood', true);

            $shipping_number = $post->get_meta('_shipping_number', true);

            $response->data['shipping']['phone'] = $shipping_phone;

            $response->data['shipping']['cellphone'] = $shipping_cellphone;

            $response->data['shipping']['neighborhood'] = $shipping_neighborhood;

            $response->data['shipping']['number'] = $shipping_number;

            return $response;

    }

The topic ‘Conflito no webhook de Assinaturas’ is closed to new replies.