Wordpress Passing do_action parameters

0
Hello, I'm having some difficulties trying to make a modification in a plugin in Woocommerce, in my plugin there is a registry of transporters, where the buyer can make a budget with all before "closing the purchase", for this I made a script that among other features, sends an email to each one.

In it I use the following code snippet:

WC()->mailer();
do_action( 'woocommerce_proposta_frete_notification');

And I use the WC_email function to process the upload, but I'm not sure how to pass the parameters to it, like the name of the product, name of the transporter among others, could anyone help me?

class WC_Frete_Email extends WC_Email {

    function __construct() {

        $this->id             = 'proposta_frete';
        $this->customer_email   = true;

        $this->transportador_email = "[email protected]";
        $this->nome_transportador = "Franey";
        $this->titulo_anuncio = "Borracha";
        $this->quantidade_anuncio = "567.00KG";
        $this->destino_anuncio = "Rio de Janeiro - RJ";
        $this->detalhes_anuncio = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quod veritatis vero animi minus atque cumque nihil nobis delectus reprehenderit, placeat mollitia error, in ipsam vel explicabo quibusdam, totam adipisci minima!";

        $this->title          = __( 'Você recebeu uma pedido de cotação de frete', 'woocommerce' );
        $this->description    = __( 'Quando um produto e criado o cliente aguarda aprovacao do administrador <!--class-mp-product-functions-->', 'woocommerce' );

        $this->template_html    = 'emails/proposta-frete.php';
        $this->template_plain   = 'emails/plain/proposta-frete.php';

        // Trigger
        add_action( 'woocommerce_proposta_frete_notification', array( $this, 'trigger' ), 10, 0 );

        // Call parent constructor
        parent::__construct();
    }

    /**
     * Get email subject.
     *
     * @since  3.1.0
     * @return string
     */
    public function get_default_subject() {
        return __( 'Você recebeu uma pedido de cotação de frete', 'woocommerce' );
    }

    /**
     * Get email heading.
     *
     * @since  3.1.0
     * @return string
     */
    public function get_default_heading() {
        return __( 'VOCÊ RECEBEU UMA SOLICITAÇÃO DE COTAÇÃO', 'woocommerce' );
    }


    /**
     * Trigger.
     *
     * @param string $user_login
     * @param string $reset_key
     */
    public function trigger( ) {
        $this->setup_locale();

        $this->object     = wp_get_current_user();
        $this->user_email = stripslashes( $this->object->user_email );
        $this->recipient  = $this->user_email;

        if ( $this->is_enabled() && $this->transportador_email ) {
            $this->send( $this->transportador_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
        }
        $this->restore_locale();

    }
    
asked by anonymous 16.07.2018 / 19:29

0 answers