Updated by Michael Visser 2016-03-22 View revision File functions.php Modified Side-by-side diff More Ignore whitespace Hide word diff return $fields; } -add_filters( 'woo_ce_product_fields', 'custom_woo_ce_extend_product_fields' ); +add_filter( 'woo_ce_product_fields', 'custom_woo_ce_extend_product_fields' ); function custom_woo_ce_extend_product_item( $product, $product_id ) { return $product; } -add_filters( 'woo_ce_product_item', 'custom_woo_ce_extend_product_item', 10, 2 ); +add_filter( 'woo_ce_product_item', 'custom_woo_ce_extend_product_item', 10, 2 ); ?>
Updated by Michael Visser 2016-03-22 View revision File functions.php Modified Side-by-side diff More Ignore whitespace Hide word diff return $product; } -add_filter( 'woo_ce_product_item', 'custom_woo_ce_extend_product_item', 10, 2 ); +add_filters( 'woo_ce_product_item', 'custom_woo_ce_extend_product_item', 10, 2 ); ?>
Updated by Michael Visser 2016-01-22 View revision File functions.php Modified Side-by-side diff More Ignore whitespace Hide word diff $fields[] = array( 'name' => 'static_field', - 'label' => __( 'Static Field', 'woo_ce' ) + 'label' => __( 'Static Field', 'woo_ce' ), + 'hover' => __( 'Static Field within functions.php', 'woo_ce' ) ); return $fields;
Created by Michael Visser 2016-01-22 View revision File functions.php Added Side-by-side diff More Ignore whitespace Hide word diff +<?php +function custom_woo_ce_extend_product_fields( $fields ) { + + $fields[] = array( + 'name' => 'static_field', + 'label' => __( 'Static Field', 'woo_ce' ) + ); + return $fields; + +} +add_filters( 'woo_ce_product_fields', 'custom_woo_ce_extend_product_fields' ); + +function custom_woo_ce_extend_product_item( $product, $product_id ) { + + $product->static_field = 'Static value'; + return $product; + +} +add_filter( 'woo_ce_product_item', 'custom_woo_ce_extend_product_item', 10, 2 ); +?>