• 0765 849 800
  • contact@code-evolution.ro
  • Acasă
  • Ce facem
    • Web Development
    • Optimizare S.E.O.
    • Promovare Google Ads
    • Social Media Marketing
    • Fotografie Comercială
  • Blog
  • Cum dai de noi
  • Acasă
  • Ce facem
    • Web Development
    • Optimizare S.E.O.
    • Promovare Google Ads
    • Social Media Marketing
    • Fotografie Comercială
  • Blog
  • Cum dai de noi
  • Acasă
  • Ce facem
    • Web Development
    • Optimizare S.E.O.
    • Promovare Google Ads
    • Social Media Marketing
    • Fotografie Comercială
  • Blog
  • Cum dai de noi

Woocommerce PHP Snippet – Adaugare poza de produs in template-ul de mail

  • Home
  • PHP Snippets
  • Woocommerce PHP Snippet – Adaugare poza de produs in template-ul de mail
Woocommerce PHP Snippet – Adaugare poza de produs in template-ul de mail
  • 28/09/2023
  • PHP Snippets, Woocommerce, Wordpress

Acesta este un snippet ce permite adaugarea de imagini de produs in template-urile de mail Woocommerce. Snippet-ul poate fi adaugat in fisierul functions.php al temei ce ruleaza la momentul respectiv pe website.

Adaugare poza de produs in template-ul de mail - snippet PHP

// Adaugare poza de produs in template-ul de mail
function add_wc_order_email_images( $table, $order ) {

	ob_start();

	$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
	wc_get_template( $template, array(
		'order'                 => $order,
		'items'                 => $order->get_items(),
		'show_download_links'   => $show_download_links,
		'show_sku'              => $show_sku,
		'show_purchase_note'    => $show_purchase_note,
		'show_image'            => true,
		'image_size'            => array( 75, 75 )
	) );

	return ob_get_clean();
}
add_filter( 'woocommerce_email_order_items_table', 'add_wc_order_email_images', 10, 2 ); 

Pentru activare folosim 2 parametrii:

show_image care se seteaza cu valoarea true

image_size care se seteaza cu valori numerice pentru dimensionarea pozei – valorile 75,75 reprezentand lungimea si latimea pozei. Parametrii se pot ajusta in functie de preferinte.

Optional, daca vreti sa afisati si codul de produs in template, modificati valoarea show_sku cu true in loc de $show_sku.

Pentru a testa modificarile, puteti sa folositi pluginul Preview E-mails for WooCommerce, plugin gratuit ce se gaseste in repository-ul WordPress:

Preview E-mails for WooCommerce

Articolul precedent

WordPress PHP Snippet – Adaugare cod Google Analytics UA / GA4 & GTM pe website fara ajutorul unui plugin

Următorul articol

Optimizare S.E.O. pentru WordPress – optimizarea vitezei de incarcare a website-ului folosind LiteSpeed

Caută

Categorii

  • Ghiduri Vizuale
  • Marketing
  • PHP Snippets
  • S.E.O. Onpage
  • Technical S.E.O.
  • Woocommerce
  • Wordpress
  • YouTube

Articole recente

10/01/2023
Ce este Black Hat S.E.O.
monetizare-youtube-shorts
09/01/2023
Monetizare YouTube Shorts: ia-ți doza de
09/01/2023
Ce este White Hat S.E.O?
06/01/2023
Ce este formatul WebP pentru imagini?
03/01/2023
Importanta tag-urilor de tip meta title
  • shape1
  • shape2
  • shape3
  • shape4
  • shape5
  • shape6
  • shape7

Abonare la newsletter!

    Link-uri utile

    • Portofoliu
    • Blog
    • Contact
    • Politica de cookies
    • Politica de confidentialitate si securitate

    Servicii

    • Web Development
    • Optimizare S.E.O.
    • Promovare Google Ads
    • Social Media Marketing
    • Servicii de Fotografie Comerciala

    Contact Rapid

    • 0765 849 800
    • contact@code-evolution.ro
    © Code Evolution 2023
    • Acasă
    • Ce facem
      • Web Development
      • Optimizare S.E.O.
      • Promovare Google Ads
      • Social Media Marketing
      • Fotografie Comercială
    • Blog
    • Cum dai de noi
    FREE ANALYSIS
    • Acasă
    • Ce facem
      • Web Development
      • Optimizare S.E.O.
      • Promovare Google Ads
      • Social Media Marketing
      • Fotografie Comercială
    • Blog
    • Cum dai de noi
    Acest website foloseste cookie-uri pentru imbunatatirea experientei utilizatorilor. Continuarea utlilzarii acestui website presupune acceptul dumneavoastra. OK Detalii
    Manage consent

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
    Necessary
    Întotdeauna activate
    Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
    CookieDuratăDescriere
    cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
    cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
    cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
    cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
    cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
    viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
    Functional
    Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
    Performance
    Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
    Analytics
    Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
    Advertisement
    Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
    Others
    Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
    SALVEAZĂ ȘI ACCEPTĂ