Allowing more than one attachment
-
There seems to be a bug that prevents multiple attachments from being sent. The same is true (I believe) with the main SIB plugin, but I’m posting it here because I’ve been able to work around it for this plugin.
The issue happens because, in line 475 of
woocommerce-sendinblue-newsletter-subscription/includes/wc-sendinblue.php
, while processing multiple attachments, you’re usingarray_merge()
with similarly structured associative arrays. Each new attachment’s name and content are thus essentially overwriting what was previously in$attachment_content
.The solution, at least for this plugin, would be to make it a properly nested array instead. I’ve found the following changes do the trick:
Line 475 in the already mentioned file:
// $attachment_content = array_merge($attachment_content, $content); $attachment_content[] = $content;
Line 519, same file:
//$data["attachment"] = array($attachment_content); $data["attachment"] = $attachment_content; // $attachment_content is already two-dimensional
- The topic ‘Allowing more than one attachment’ is closed to new replies.