Automattic\WooCommerce\Gateways\PayPal
Buttons::get_current_page_for_app_switch
Get the current page URL, to be used for App Switch. Limited to checkout, cart, and product pages for security.
Method of the class: Buttons{}
No Hooks.
Returns
String.
Usage
$Buttons = new Buttons(); $Buttons->get_current_page_for_app_switch(): string;
Changelog
| Since 10.5.0 | Introduced. |
Buttons::get_current_page_for_app_switch() Buttons::get current page for app switch code WC 10.8.1
public function get_current_page_for_app_switch(): string {
// If checkout, cart or product page, return the current page URL.
if ( wc_get_container()->get( LegacyProxy::class )->call_function( 'is_checkout' ) || is_cart() || is_product() ) {
return get_permalink( get_the_ID() );
}
return '';
}