Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

WooCommerce: Custom Fields

11 Aufrufe

Veröffentlicht am

These slides belong to https://CustomizeWoo.com, a technical video course that shows you how to override WooCommerce pages and elements without using plugins. You can watch me code and learn by example.

A series of videos, screencasts, examples and exercises will help you feel more confident about WooCommerce customization, child themes, hooks and CSS/PHP snippets.

Watch and re-watch each video how many times you like, get lifetime access to me via the comment section, exercise as much as possible and keep learning.

Access your free videos or buy the course via https://businessbloomer.com/customizewoo-master-woocommerce-online-course/

Veröffentlicht in: Internet
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

WooCommerce: Custom Fields

  1. 1. Advanced Customization: Custom Fields CustomizeWoo.com
  2. 2. "Custom Field" "Custom Fields (post meta, metadata) allow you to store additional information with each WordPress post. They can then be displayed/used anywhere" CustomizeWoo.com
  3. 3. WC Product = WP Post + CF CustomizeWoo.com
  4. 4. Some WC Product Custom Fields! CustomizeWoo.com ● '_visibility' ● '_sku' ● '_price' ● '_regular_price' ● '_sale_price' ● '_sale_price_dates_from' ● '_sale_price_dates_to' ● 'total_sales' ● '_tax_status' ● '_tax_class' ● '_manage_stock' ● '_stock' ● '_stock_status' ● '_backorders' ● '_low_stock_amount' ● '_sold_individually' ● '_weight' ● '_length'
  5. 5. Custom Fields Benefits CustomizeWoo.com ● Target specific post/product ID (conditional behavior) ● Store information forever ● Use it or return it to screen whenever/wherever you like: alter behaviour (price) or add data (e.g. RRP)
  6. 6. (1a) Add Custom Field Manually CustomizeWoo.com
  7. 7. (1b) Add Custom Field By Code CustomizeWoo.com update_post_meta( $post_id, $meta_key, $meta_value ); update_post_meta( 456, 'packaging_weight', '2' ); (codex.wordpress.org/Function_Reference/update_post_meta)
  8. 8. (2) Get Custom Field By Code CustomizeWoo.com get_post_meta( $post_id, $meta_key, $single = false ); echo get_post_meta( 456, 'packaging_weight', true ); echo get_post_meta( 789, 'total_sales', true ); echo get_post_meta( 123, '_regular_price', true ); echo $product->get_regular_price(); (developer.wordpress.org/reference/functions/get_post_meta/)
  9. 9. Custom Fields Workflow CustomizeWoo.com 1. Project specs e.g. "Display packaging weight @ product ID = 556" 2. Add custom field name=>value @ product ID = 556 3. Get post meta and return it to the screen

×