%s', esc_html__( 'ورود به حساب کاربری', 'rahkar-toolkit' ) ); echo '
'; // `woocommerce_login_form()` rather than `woocommerce_checkout_login_form()`: // the former renders the form itself, the latter wraps it in the collapsed // "click here to login" toggle that was just removed. // // Going through WooCommerce's function rather than printing markup here is // what keeps this theme-agnostic — it resolves `global/form-login.php` // through the template hierarchy, so Woodmart renders the Woodmart form, a // different theme renders its own, and a theme with no override gets // WooCommerce's default. The code panel arrives inside all of them through // the standard `woocommerce_login_form_start` action. woocommerce_login_form( [ 'redirect' => wc_get_checkout_url(), 'hidden' => false, ] ); echo '
'; $this->printGateStyles(); } /** * Styles that undo the theme's collapsed-form treatment. * * Woodmart stamps `hidden-form` onto its login form whenever `is_checkout()` * is true, because it expects the form to sit behind WooCommerce's toggle. * With the toggle gone the class would leave the gate showing nothing at all, * so it is overridden — scoped to the gate wrapper, so every other login form * on the site keeps the behaviour the theme intended. * * Inline and tiny: this has to apply before first paint, and loading a * stylesheet for six rules would cost a request on the one page where the * customer is closest to buying. */ private function printGateStyles(): void { ?> .rahkar-gate .hidden-form{display:block!important} .rahkar-gate form.login{max-width:420px;margin:0 auto} .rahkar-gate__title{margin:0 0 18px;text-align:center} .woocommerce-form-login-toggle{display:none}