When I click a button that sends me to a controller action in Magento, where is the code that directs the browser to a new URL? I've been trying to trace the code with the debugger, but I can't find the line of PHP code (or lines of code) that actually assign the browser's URL.

The reason I'm asking is that Magento is putting a hash at the end of my checkout URL, and I'm trying to track down what's adding the hash.

Here is the Javascript behind the button that I'm clicking

], function ($) {
    "use strict";
    return function (config, element) {
        $(element).click(function () {
            var form = $(config.form);
            var baseUrl = form.attr('action'),
            buyNowUrl = baseUrl.replace('checkout/cart/add', 'buynow/cart/add');
            form.attr('action', buyNowUrl);
            form.attr('action', baseUrl);
            return false;

After clicking the button, I get redirected to example.com/checkout/#93=4. I'm trying to find the code that's adding the #93=4 to the URL. My guess is that the #93=4 is addended to the URL for the "add to cart" action because 93 is the EAV ID of the configurable option, and 4 is my selected configurable option, but I can't find where it's getting appended. My goal is to figure out a way to strip that off when I get redirected to the checkout page.

  • Are you able to inspect the markup of the button you are clicking? What does it look like? May 31, 2019 at 18:55
  • Yes. I updated the question with that Javascript. The button adds the current product to the cart, and then redirects to the Checkout page.
    – Ben Rubin
    May 31, 2019 at 19:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.