simppa999
Forum Replies Created
-
Hello @priyankajagtap , and sorry for late replay. Your screenshots are exactly what I got also. But it is wrong, as I have custom woocommerce templates for receipt that is working well when printing on order or orders list. Under child themes woocommerce/print-order. This template should apply also on when attaching to emails. Please.
- This reply was modified 9 months, 3 weeks ago by simppa999.
For me it seems more like a bug as all payment’s methods should have title attribute filled.
Hello, please look on this site: WooCommerce Code Reference and look property called $title. Please add value for that “title” on Klarna payment gateway. As its now empty.
- This reply was modified 1 year, 3 months ago by simppa999.
If you print out the payment method gateway object the property called “title” is empty. And that cause following WPML function to return empty payment method name, so please fix it by adding the title for Klarna payment method. It could be as field on plugin settings or just static “Klarna” would do it.
<?php
use WPML\FP\Fns;
class WCML_Payment_Method_Filter {
/** @var array */
private $payment_gateway_cache = [];
public function add_hooks() {
add_filter(
'woocommerce_order_get_payment_method_title',
Fns::withoutRecursion( Fns::identity(), [ $this, 'payment_method_string' ] ),
10,
2
);
}
public function payment_method_string( $title, $object ) {
if ( ! empty( $title ) && $object->get_id() ) {
$payment_gateway = $this->get_payment_gateway( $object->get_id() );
if ( isset( $_POST['payment_method'] ) && $payment_gateway->id !== $_POST['payment_method'] && WC()->payment_gateways() ) {
$payment_gateways = WC()->payment_gateways()->payment_gateways();
if ( isset( $payment_gateways[ $_POST['payment_method'] ] ) ) {
$payment_gateway = $payment_gateways[ $_POST['payment_method'] ];
}
}
if ( $payment_gateway ) {
$settings = maybe_unserialize( get_option( 'woocommerce_' . $payment_gateway->id . '_settings' ) );
$title = apply_filters(
'wpml_translate_single_string',
! empty( $settings['title'] ) ? $settings['title'] : $payment_gateway->title,
'admin_texts_woocommerce_gateways',
$payment_gateway->id . '_gateway_title'
);
if ( $title === $payment_gateway->title ) {
if ( 'cheque' === $payment_gateway->id && $title === $payment_gateway->title ) {
$title = _x( $payment_gateway->title, 'Check payment method', 'woocommerce' );
} else {
$title = __( $payment_gateway->title, 'woocommerce' );
}
}
}
}
return $title;
}- This reply was modified 1 year, 3 months ago by simppa999.
Hello, actually I managed to resolve the issue easily using WPML functions on invoice templates.
Get order language that is saved by WPML:
get_post_meta($order->get_id(), ‘wpml_language’, true);Set that language afterwards:
do_action( ‘wpml_switch_language’, $lang );
In the end revert that setting to the current language.Forum: Plugins
In reply to: [Posti Shipping] Seurantakoodit ei mukana kuittausviestissäSeurantakoodin lisäyksen myös cronin kautta tehdyissä posteissa saa toimimaan lisäämällä koodiin (core/class-core.php) riville 197 “|| wp_doing_cron()”:
if ( is_admin() || wp_doing_cron()) {
Thank you for replay. Still not working, but need to try debug more.
Forum: Plugins
In reply to: [Posti Shipping] Seurantakoodit ei mukana kuittausviestissäTämä ongelma liittyy siihen jos tilaa vaihdetaan cronilla, eli pitäs lisätä seurntakoodin lisäys myös wp_doing_cron() tapauksissa eikä vain is_admin() tilanteessa. ks. hooks not fired on order complete email | ww.wp.xz.cn
You are correct, the tracking codes are attached when running the cron manually. So the change needed to be done in “posti shipping” plugin.
Do you have good suggestion how to include plugin hooks “$this->admin = $this->load_admin_class()” only for cron, and not always? Please.
Hello and thank you for replay.
The plugin is this: https://ww.wp.xz.cn/plugins/posti-shipping/
The action is this: class-admin.php in posti-shipping/trunk/core – WordPress Plugin Repository
The function is this: class-admin.php in posti-shipping/trunk/core – WordPress Plugin RepositoryThanks
Forum: Plugins
In reply to: [Google for WooCommerce] Custom product image mappingThank you for replay. So need to stick old plugin that I was using.