Ex: There are Tokyo, Osaka, Seoul, Shanghai in the select list in Product Custom Field option. There are only the Tokyo, Osaka when the user chooses Japan, there aren’t Seoul and Shanghai
]]>I’ve created a custom invoice template, and tried adding the code as you recommend, so I have:
<?php $this->custom_field('_hscode'); ?>
Yet still nothing shows up on my invoice. I’m not well versed in php though, so maybe I’m making a simple error somewhere. Here’s a fuller picture of what I’ve done in my custom template:
<span class="item-meta"><?php echo $item['meta']; ?></span>
<dl class="meta">
<?php $description_label = __( 'SKU', 'woocommerce-pdf-invoices-packing-slips' ); // registering alternate label translation ?>
<?php if( !empty( $item['sku'] ) ) : ?><dt class="sku"><?php _e( 'SKU:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="sku"><?php echo $item['sku']; ?></dd><?php endif; ?>
<?php if( !empty( $item['weight'] ) ) : ?><dt class="weight"><?php _e( 'Weight:', 'woocommerce-pdf-invoices-packing-slips' ); ?></dt><dd class="weight"><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?><?php endif; ?>. HS Code: <?php $this->custom_field('_hscode'); ?></dd>
</dl>
<?php do_action( 'wpo_wcpdf_after_item_meta', $this->type, $item, $this->order ); ?>
We want the HS Code (_hscode) to show up on the same line as the Weight, under each product.
Any help would be much appreciated.
]]>I would like to have some help please in order to display a custom field of each product in the invoice.
Can someone please help on that? I have a custom field called manufacter_id for each product and I would like to make that been visible in pdf invoice.
thanks
]]>I have add one custom field on product submission in back-end, and it is work fine in back-end product submission.
But I want to add same custom field in front-end product submission form.
Here is the code I have added in themes functions.php file to display custom field in back-end.
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
// Text Field
$playstore_url_text_field = woocommerce_wp_text_input(
array(
'id' => 'playstore_url',
'label' => __( 'App Play store URL', 'woocommerce' ),
'placeholder' => 'https://',
'desc_tip' => 'true',
'description' => __( 'App Google Play store URL', 'woocommerce' )
)
);
}
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
function woo_add_custom_general_fields_save( $post_id ){
// Text Field
$playstore_url_text_field = $_POST['playstore_url'];
if( !empty( $playstore_url_text_field ) ) {
update_post_meta( $post_id, 'playstore_url', esc_attr( $playstore_url_text_field ) );
} else {
update_post_meta( $post_id, 'playstore_url', '' );
}
}
Using above code, I have add one custom text field in back-end and it is work perfect with add, update and delete functionality.
How can I add same custom text field in front-end?
Here is my code for front-end text field.
<input class="" type="text" name="playstore_url" value="<?php echo esc_attr( get_post_meta( get_the_ID(), 'playstore_url', $playstore_url_text_field ) ); ?>" />
One thing, If I will add this custom field value from front-end then value should be added to that custom field in back-end and vice versa.
Thanks in advance.
https://www.ads-software.com/plugins/woocommerce/
]]>I have add one custom field on product submission in back-end, and it is work fine in back-end product submission.
But I want to add same custom field in front-end product submission form.
Here is the code I have added in themes functions.php file to display custom field in back-end.
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
// Text Field
$playstore_url_text_field = woocommerce_wp_text_input(
array(
'id' => 'playstore_url',
'label' => __( 'App Play store URL', 'woocommerce' ),
'placeholder' => 'https://',
'desc_tip' => 'true',
'description' => __( 'App Google Play store URL', 'woocommerce' )
)
);
}
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
function woo_add_custom_general_fields_save( $post_id ){
// Text Field
$playstore_url_text_field = $_POST['playstore_url'];
if( !empty( $playstore_url_text_field ) ) {
update_post_meta( $post_id, 'playstore_url', esc_attr( $playstore_url_text_field ) );
} else {
update_post_meta( $post_id, 'playstore_url', '' );
}
}
Using above code, I have add one custom text field in back-end and it is work perfect with add, update and delete functionality.
How can I add same custom text field in front-end?
Here is my code for front-end text field.
<input class="" type="text" name="playstore_url" value="<?php echo esc_attr( get_post_meta( get_the_ID(), 'playstore_url', $playstore_url_text_field ) ); ?>" />
One thing, If I will add this custom field value from front-end then value should be added to that custom field in back-end and vice versa.
Thanks in advance.
]]>