niikk
Forum Replies Created
-
@rur165 I guess the code above should work. But I thins the class from the array is wrong. Where is this class defined?
Thanks. Yeah.. now its working. But always change this after a update is stupid. 😄
But I guess it should not be that hard so create a filter to unset that via function.php file?I tried with that.. but does not work.. any ideas why? 🙂
add_action( 'plugins_loaded', 'webearth_remove_plugin_filter' ); function webearth_remove_plugin_filter() { remove_filter( 'woocommerce_order_item_get_formatted_meta_data', array('constructor', 'hide_extra_data'), 10 ); }- This reply was modified 5 years, 3 months ago by niikk.
Hi @rur165
Now I also tried to access the order product meta array… But same result. Nothing is displayed. Can it be that hard just to display those values?! hehe 😂
function display_product_commissions($order){ global $post; $order = wc_get_order( $post->ID ); $items = $order->get_items(); foreach ( $order->get_items() as $item_id => $item ) { // Here you get your data $custom_field = wc_get_order_item_meta( $item_id, '_dokan_commission_rate', true ); // To test data output (uncomment the line below) print_r($custom_field); // Iterating in an array of keys/values foreach( $custom_field as $key => $value ){ echo '<p>key: '.$key.' | value: '.$value.'</p>'; } } } add_action( 'woocommerce_checkout_create_order_line_item', 'display_product_commissions', 10, 1 );I saw, that in dokan-lite commission.php you guys use a function to hide those values:
/** * Hide extra meta data * * @since 2.9.21 * * @param array * * @return array */ public function hide_extra_data( $formated_meta ) { $meta_to_hide = [ '_dokan_commission_rate', '_dokan_commission_type', '_dokan_additional_fee' ]; $meta_to_return = []; foreach ( $formated_meta as $key => $meta ) { if ( ! in_array( $meta->key, $meta_to_hide ) ) { array_push( $meta_to_return, $meta ); } } return $meta_to_return; }- This reply was modified 5 years, 3 months ago by niikk.
Hello @rur165
Yes, So we want to display under each product in the order the commission typ and commission rate. With
wc_add_order_item_metwe will display the commission from the whole order right?Like in that example here the “name your shirt row”: https://rudrastyh.com/wp-content/uploads/2018/02/woocommerce-order-items-in-admin.png
I’m not able to display the needed information with this code here. Hoe do I have to access this
_dokan_commission_rateand_dokan_commission_type?add_action( 'woocommerce_checkout_create_order_line_item', display_product_vendor_earnings', 10, 4 ); function display_product_vendor_earnings( $item, $cart_item_key, $values, $order ) { if ( !empty( $values['_dokan_commission_rate'] ) ) { $item->add_meta_data( 'Product commission:', $values['_dokan_commission_rate'] ); } }Or with that one:
function display_product_commissions($order){ echo "<p><strong>Name of pickup person:</strong> " . $order->order_custom_fields['_dokan_commission_type'][0] . "</p>"; } add_action( 'woocommerce_checkout_create_order_line_item', 'display_product_commissions', 10, 1 );You should be able to copy that in your function.php and then it should be displayed IF the code works 😉 Because those values are already stored in the order right?
- This reply was modified 5 years, 3 months ago by niikk.
Forum: Plugins
In reply to: [WP Mail Logging] Emails containing an emoticon are not logged 😉!Hi all,
Same problem here.. would be nice if that would work! 🙂
Was able to solve it 🙂
Forum: Plugins
In reply to: [Sequential Order Number for WooCommerce] Get order numberPerfect! Thanks
Forum: Plugins
In reply to: [WooCommerce] Product attribute order on product pageWould be nice! 🙂
Hello @rur165
It’s working now. All good! 🙂
But the question, if we can display the sub order’s in the order conformation mail is still open.
Did you see here any change of doing this via custom code?
Cheers
Forum: Plugins
In reply to: [Advanced AJAX Product Filters] Create filter for featured productsForum: Plugins
In reply to: [Customer Reviews for WooCommerce] Sent reminder for bundle productsHello @cusrev
Any feedback on this? Maybe you can tell us how we have to do custom code in order that we can send you reminders from such bundle products. 🙂
Thanks
Hello @rur165
This is awesome! Nice. But I can not click the storename in order to filter for all products from the same store. (Same as the default Dokan “Author” column does)
I guess I have to use something like that. In which Dokan file can I see how you did that for the author column?
function apply_my_custom_product_filters( $query ) { global $pagenow; if ( $query->is_admin && $pagenow == 'edit.php' && isset( $_GET['my_filter'] ) && $_GET['my_filter'] != '' && $_GET['post_type'] == 'product' ) { // Create meta query array and add to WP_Query $meta_key_query = array( array( 'key' => '_my_meta_value', 'value' => esc_attr( $_GET['my_filter'] ), ) ); $query->set( 'meta_query', $meta_key_query ); } } add_action( 'pre_get_posts', 'apply_my_custom_product_filters' );Currently we are trying with that code but does not work:
add_filter( 'manage_edit-product_columns', 'show_product_order',15 ); function show_product_order($columns){ //add column $columns['vendor_store_name'] = __( 'Vendor'); return $columns; } function get_dokan_vendor_shop_name_from_product_test( $product_id ) { if( empty($product_id) ) return; $seller = get_post_field( 'post_author', $product_id ); $author = get_user_by( 'id', $seller ); $vendor = dokan()->vendor->get( $seller ); $store_info = dokan_get_store_info( $author->ID ); } add_filter( 'manage_product_posts_custom_column', 'vendor_product_column', 10, 2 ); function vendor_product_column( $column, $postid ) { if ( $column == 'vendor_store_name' ) { $product = new WC_Product($postid); echo get_post_meta( $postid, $store_info, true ); } }- This reply was modified 5 years, 4 months ago by niikk.
@cartflows Thanks
Is there a recommended plugin for this for cartflows?