2015-05-01 13 views

risposta

12

mio account shortcode:

[woocommerce_my_account order_count="-1"] 

Shows the ‘my account’ section where the customer can view past orders and update their information. You can specify the number or order to show, it’s set by default to 15 (use -1 to display all orders.)

Riferimento: Woocommerce Shortcodes


Aggiornamento

Se avete bisogno solo le decisioni non so se c'è alread y uno shortcode, ma ho fatto una presa woocommerce_my_account come ad esempio:

function shortcode_my_orders($atts) { 
    extract(shortcode_atts(array(
     'order_count' => -1 
    ), $atts)); 

    ob_start(); 
    wc_get_template('myaccount/my-orders.php', array(
     'current_user' => get_user_by('id', get_current_user_id()), 
     'order_count' => $order_count 
    )); 
    return ob_get_clean(); 
} 
add_shortcode('my_orders', 'shortcode_my_orders'); 

aggiungere questo al file functions.php e quindi utilizzarlo come [my_orders order_counts=10] (order_counts è opzionale, se mancante elenca tutti gli ordini).

+0

in realtà solo mi ha inviato alla mia pagina conti dove l'utente può vedere i loro indirizzi di spedizione e il messaggio di benvenuto, quando nella tua pagina Account. – dave

+0

grazie mille amico. Proverò appena possibile. – dave

+0

ok ho provato a inserire il codice sopra in ROOT/wp-includes/functions.php ma mi ha dato "Errore irreversibile: chiamata alla funzione non definita add_shortcode() in C: \ xampp \ htdocs \ localpressjuicery \ wp-includes \ functions. php " – dave

0

Stavo leggendo di estratto e apparentemente non è più raccomandato da Wordpress. Ho trovato questo soloution, spero che questo aiuta:

function shortcode_my_orders($atts) { 
$args= shortcode_atts( 
array(
    'order_count' => -1 
    ), 
$atts 
); 
$order_count = esc_attr($args['order_count']); 


ob_start(); 
wc_get_template('myaccount/my-orders.php', array(
    'current_user' => get_user_by('id', get_current_user_id()), 
    'order_count' => $order_count 
)); 
return ob_get_clean(); 

}

+0

ciao come posso includere il nome? – winresh24

Problemi correlati