Hallo @newshop Kannst du uns bitte den WC Status Report zur verfügung stellen. Alternatv auch gerne an [email protected] senden. Vielen Dank
@newshop bitte deaktiviere auch testweise alle anderen Plugins. Möglicherweise verursacht hier ein anderes Plugin diesen Fehler
Ich hab den Fehler gefunden, ich hatte folgenden Code in meiner functions.php stehen, weil ich die Bankdetails auf der Danke-Seite nicht anzeigen möchte:
add_action( 'init', 'remove_bacs_from_thank_you_page', 100 );
function remove_bacs_from_thank_you_page() {
// Bail, if we don't have WC function
if ( ! function_exists( 'WC' ) ) {
return;
}
// Get all available gateways
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
// Get the Bacs gateway class
$gateway = isset( $available_gateways['bacs'] ) ? $available_gateways['bacs'] : false;
// We won't do anything if the gateway is not available
if ( false == $gateway ) {
return;
}
// Remove the action, which places the BACS details on the thank you page
remove_action( 'woocommerce_thankyou_bacs', array( $gateway, 'thankyou_page' ) );
}
Wie muss ich den Code modifizieren, damit er weiterhin mit eurem Plugin kompatibel ist? Bis vor Version 2.0.0 hatte er ja keine Probleme gemacht…
Hallo @newshop, kannst du bitte es einmal so probieren
add_action(‘woocommerce_init’, ‘remove_bacs_from_thank_you_page’, 100);
Vielen Dank
Danke, gerade ausprobiert, aber leider kommt immernoch der FatalError..
Hallo @newshop
kannst du das bitte einmal so abändern?
add_action('woocommerce_init', 'remove_bacs_from_thank_you_page', 100);
function remove_bacs_from_thank_you_page()
{
if (is_admin()) {
return;
}
// Bail, if we don't have WC function
if (!function_exists('WC')) {
return;
}
// Get all available gateways
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
// Get the Bacs gateway class
$gateway = isset($available_gateways['bacs']) ? $available_gateways['bacs'] : false;
// We won't do anything if the gateway is not available
if (false == $gateway) {
return;
}
// Remove the action, which places the BACS details on the thank you page
remove_action('woocommerce_thankyou_bacs', [$gateway, 'thankyou_page']);
}
if (is_admin()) {
return;
}
Vielen Dank
@newshop bitte auch das hier einmal testen
add_action( 'woocommerce_thankyou_bacs', 'remove_bacs_from_thank_you_page', 5 );
function remove_bacs_from_thank_you_page() {
// Get all available gateways
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
// Remove the action, which places the BACS details on the thank you page
remove_action( 'woocommerce_thankyou_bacs', array( $available_gateways['bacs'], 'thankyou_page' ) );
}
Vielen Dank
Ja super, danke, das funktioniert beides.
Die zweite Version ist ja etwas schlanker, d.h. die wäre zu bevorzugen oder?
@newshop Das freut mich zu hören. Wir würden uns über eine positive 5 Sterne Bewertung sehr freuen.
Vielen Dank
-
This reply was modified 7 years, 1 month ago by
Andreas W..