Last active
August 29, 2015 14:17
-
-
Save thisislawatts/87eb1ab9207a8ec30729 to your computer and use it in GitHub Desktop.
Shopify - Bulk Redirect Import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var directs = [{ | |
old: "/i-am-an-old-url", | |
new: "/i-am-your-new-url" | |
}]; | |
var counter = 0; | |
var $addURLRedirect = jQuery('a[bind-event-click*="addUrlRedirectModal"]'); | |
var currentRedirect; | |
addRedirect = function() { | |
$addURLRedirect.trigger('click'); | |
setTimeout(function() { | |
currentRedirect = directs[counter]; | |
jQuery('#redirect_path').val(currentRedirect['old']); | |
jQuery('#redirect_target').val(currentRedirect['new']).trigger('change'); | |
jQuery('.new_redirect .js-btn-primary').trigger('click'); | |
counter++; | |
if ( counter < directs.length ) { | |
setTimeout(function() { | |
addRedirect(); | |
}, 800); | |
} | |
}, 1500); | |
} | |
addRedirect(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment