Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/30/2019 in all areas

  1. The two chunks of code you've posted are completely unrelated. I don't know what mf_get_option('login_reg_popup') should or could return, but if it's falsey it'll set the action parameter of your checkout button link to the login page. If it's truthy it'll set it to ... nothing, really. Your second chunk of code redirects everything to $_SERVER['HTTP_REFERRER'] (which I'm pretty sure is a massive security issue, not to mention the fact that it applies to everything). Then, later - assuming the code gets there after the ill-advised redirect - it sets up an action handler for template_redirect that again calls the wpse_131562_redirect() function on every page load. Assuming mf_get_option('login_reg_popup') returns false if the user is not logged in, I think what you want to do is replace the '#' in your first code chunk with wc_get_checkout_url().
    1 point
  2. You can't just copy code and expect it to work without understanding what it does. That you are using 'wp_redirect' indicates you are writing a WordPress application. What error are you getting? Also your coding is vary hard to read and not good programming practice. You should modularlize your PHP code. A process section and presentation section. Don't embed PHP into HTML like that, build the output string in then echo it.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.