Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shipping_pole_url and it's purpose? #11

Open
rycao18 opened this issue Nov 24, 2017 · 0 comments
Open

shipping_pole_url and it's purpose? #11

rycao18 opened this issue Nov 24, 2017 · 0 comments

Comments

@rycao18
Copy link

rycao18 commented Nov 24, 2017

To whom it may concern,

I've been trying to get this bot working again, and I've come across something that I can't really figure out. I was wondering if I could get some insight from one of the bot's contributors as to what exactly these lines of code do, specifically the const shipping_pole_url and what that's purpose is? What exactly is that supposed to return? I think after the shopify update, this no longer exists? I was wondering why this const was there and what I should be looking for instead.

In case you're wondering, this is from the ship method

const $ = cheerio.load(body);
    const shipping_pole_url = $(
      'div[data-poll-refresh="[data-step=shipping_method]"]'
    ).attr('data-poll-target');
    if (shipping_pole_url === undefined) {
      const firstShippingOption = $(
        'div.content-box__row .radio-wrapper'
      ).attr('data-shipping-method');
      if (firstShippingOption == undefined) {
        log(
          `${config.base_url} is Incompatible, sorry for the inconvenience. A browser checkout session will be opened momentarily.`
        );
        open(url);
        process.exit(1);
      } else {
        return submitShipping(config, slackBot, {
          type: 'direct',
          value: firstShippingOption,
          auth_token: $('input[name="authenticity_token"]').val(),
        });
      }
    }
    return submitShipping(config, slackBot, {
      type: 'poll',
      value: shipping_pole_url,
    });
  } 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant