Woocommerce Germanized Shortcodes

Below, you’ll find a detailed guide on how to add the Germanized for WooCommerce Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Germanized for WooCommerce Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Germanized for WooCommerce Plugin and the shortcodes it provides:

Plugin Icon
Germanized for WooCommerce

"Germanized for WooCommerce is a plugin that tailors your WooCommerce store to the specific legal conditions of the German market. It ensures compliance with German e-commerce laws."

★★★★☆ (457) Active Installs: 80000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [revocation_form]
  • [page]
  • [add_shortcode]
  • [gzd_return_request_form]

[revocation_form] Shortcode

The WooCommerce-Germanized plugin’s shortcode, ‘revocation_form’, allows for online forwarding of your withdrawal. It creates a link to the revocation page, enabling easy navigation for users.

Shortcode: [revocation_form]

Examples and Usage

Basic example – A straightforward usage of the shortcode to display a revocation form link.

[revocation_form /]

PHP Function Code

In case you have difficulties debugging what causing issues with [revocation_form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'revocation_form', array( $this, 'revocation_form_replacement' ) );

Shortcode PHP function:

function revocation_form_replacement( $atts ) {
		return '<a href="' . esc_url( wc_gzd_get_page_permalink( 'revocation' ) ) . '">' . _x( 'Forward your withdrawal online', 'revocation-form', 'woocommerce-germanized' ) . '</a>';
	}

Code file location:

woocommerce-germanized/woocommerce-germanized/includes/class-wc-gzd-emails.php

[page] Shortcode

The Woocommerce-Germanized plugin shortcode enables the creation of custom links in WordPress. This shortcode creates a hyperlink with customized attributes like ‘id’, ‘target’, ‘text’, and ‘url’. If no ‘id’ or ‘url’ is provided, it returns false. If no content is provided, it uses the post title or the ‘text’ attribute as the link text. The ‘target’ attribute defines how the link opens.

Shortcode: [page]

Parameters

Here is a list of all possible page shortcode parameters and attributes:

  • id – Unique identifier of the page to be linked.
  • target – Defines how the link will open, “_blank” opens in a new tab.
  • text – Custom text to be displayed for the link.
  • url – Specific URL to be used instead of the page’s permalink.

Examples and Usage

Basic example – A simple usage of the shortcode to reference a specific page by its ID:

[page id=1 /]

Advanced examples

Using the shortcode to reference a specific page by its ID and alter the hyperlink text:

[page id=2 text="Click Here" /]

Using the shortcode to reference a specific page by its ID, alter the hyperlink text, and set the target to open in a new tab:

[page id=3 text="Visit Our Shop" target="_blank" /]

Using the shortcode to reference a specific URL instead of a page ID, and alter the hyperlink text:

[page url="https://www.example.com" text="Visit Our Partner" /]

Using the shortcode to reference a specific URL, alter the hyperlink text, and set the target to open in a new tab:

[page url="https://www.example.com" text="Visit Our Partner" target="_blank" /]

These examples illustrate the flexibility of the ‘page’ shortcode provided by the woocommerce-germanized plugin. By adjusting the parameters within the shortcode, you can easily customize the hyperlink’s behavior and display text.

PHP Function Code

In case you have difficulties debugging what causing issues with [page] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'page', '_wc_gzd_page_shortcode' );

Shortcode PHP function:

function _wc_gzd_page_shortcode( $atts, $content = '' ) {
	$atts = wp_parse_args(
		$atts,
		array(
			'id'     => 0,
			'target' => '_blank',
			'text'   => '',
			'url'    => '',
		)
	);

	if ( ( empty( $atts['id'] ) || ! get_post( $atts['id'] ) ) && empty( $atts['url'] ) ) {
		return false;
	}

	if ( empty( $content ) ) {
		if ( empty( $atts['text'] ) ) {
			$content = get_the_title( $atts['id'] );
		} else {
			$content = $atts['text'];
		}
	}

	$url = ( empty( $atts['url'] ) ? get_permalink( $atts['id'] ) : $atts['url'] );

	return '<a href="' . esc_url( $url ) . '" target="' . esc_attr( $atts['target'] ) . '">' . $content . '</a>';
}

Code file location:

woocommerce-germanized/woocommerce-germanized/includes/wc-gzd-core-functions.php

Germanized for WooCommerce [gzd_return_request_form] Shortcode

The Woocommerce-Germanized plugin shortcode, ‘gzd_return_request_form’, generates a return request form for customers. It allows customization of the form with options like a custom message and hidden fields.

Shortcode: [gzd_return_request_form]

Parameters

Here is a list of all possible gzd_return_request_form shortcode parameters and attributes:

  • message – custom text displayed on the return request form
  • hidden – controls the visibility of the return request form

Examples and Usage

Basic example – Displaying the return request form without any custom message or hidden attribute.

[gzd_return_request_form /]

Advanced examples

Displaying the return request form with a custom message. The message will be displayed at the top of the form.

[gzd_return_request_form message="Please fill out the form below to request a return." /]

Displaying the return request form with the form initially hidden. The form can be shown by clicking on a button or link.

[gzd_return_request_form hidden="true" /]

Displaying the return request form with a custom message and the form initially hidden. This combines the two previous examples.

[gzd_return_request_form message="Please fill out the form below to request a return." hidden="true" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [gzd_return_request_form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'gzd_return_request_form', array( __CLASS__, 'return_request_form' ) );

Shortcode PHP function:

function return_request_form( $args = array() ) {
		$defaults = array(
			'message' => '',
			'hidden'  => false,
		);

		$args    = wp_parse_args( $args, $defaults );
		$notices = function_exists( 'wc_print_notices' ) ? wc_print_notices( true ) : '';
		$html    = '';

		// Output notices in case notices have not been outputted yet.
		if ( ! empty( $notices ) ) {
			$html .= '<div class="woocommerce">' . $notices . '</div>';
		}

		$html .= wc_get_template_html( 'global/form-return-request.php', $args );

		return $html;
	}

Code file location:

woocommerce-germanized/woocommerce-germanized/packages/woocommerce-germanized-shipments/src/Package.php

Conclusion

Now that you’ve learned how to embed the Germanized for WooCommerce Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *